# bzoj2594: [Wc2006]水管局长数据加强版

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ls c[x][0]
#define rs c[x][1]
using namespace std;
const int maxm=1000010,maxq=100010,maxt=1500010;
int n,m,Q,f[maxt],tim;char ch;
struct edge{int u,v,w,id;bool d;}e[maxm];
struct qu{int f,x,y,ans,id;}q[maxm];
bool operator<(edge a,edge b){return a.u<b.u||(a.u==b.u&&a.v<b.v);}
for (ch=getchar();!isdigit(ch);ch=getchar());
for (x=0;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
}

struct LCT{
int fa[maxt],c[maxt][2],val[maxt],mx[maxt];bool rev[maxt];
int which(int x){return c[fa[x]][1]==x;}
bool isroot(int x){return c[fa[x]][0]!=x&&c[fa[x]][1]!=x;}
void update(int x){
mx[x]=x;
if (val[mx[ls]]>val[mx[x]]) mx[x]=mx[ls];
if (val[mx[rs]]>val[mx[x]]) mx[x]=mx[rs];
}
void flip(int x){swap(ls,rs),rev[x]^=1;}
void down(int x){if (rev[x]) flip(c[x][0]),flip(c[x][1]),rev[x]^=1;}
void relax(int x){if (!isroot(x)) relax(fa[x]);down(x);}
void rotate(int x){
int y=fa[x],z=fa[y],nx=which(x),ny=which(y);
fa[c[x][!nx]]=y,c[y][nx]=c[x][!nx];
fa[x]=z;if (!isroot(y)) c[z][ny]=x;
fa[y]=x,c[x][!nx]=y;update(y);
}
void splay(int x){
relax(x);
while (!isroot(x)){
if (isroot(fa[x])) rotate(x);
else if (which(x)==which(fa[x])) rotate(fa[x]),rotate(x);
else rotate(x),rotate(x);
}
update(x);
}
void access(int x){for (int p=0;x;p=x,x=fa[x]) splay(x),fa[c[x][1]=p]=x,update(x);}
void makeroot(int x){access(x),splay(x),flip(x);}
void cut(int a,int b){makeroot(a),access(b),splay(b),c[b][0]=fa[a]=0;}
int query(int a,int b){makeroot(a),access(b),splay(b);return mx[b];}
}T;

int getfa(int x){return f[x]==x?x:f[x]=getfa(f[x]);}
int find(int u,int v){
int l=1,r=m;
while (l<=r){
int mid=(l+r)>>1;
if (e[mid].u<u||(e[mid].u==u&&e[mid].v<v)) l=mid+1;
else if (e[mid].u==u&&e[mid].v==v) return mid;
else r=mid-1;
}
}
bool cmp(edge a,edge b){return a.w<b.w;}
bool cmp2(edge a,edge b){return a.id<b.id;}

void kruskal(){
int tot=0;
for (int i=1;i<=m;i++)
if (!e[i].d){
int u=e[i].u,v=e[i].v;
if (getfa(u)!=getfa(v)){
//				printf("MST%d %d %d %d\n",u,v,e[i].w,e[i].d);
if (++tot==n-1) break;
}
}
}

int main(){
scanf("%d%d%d",&n,&m,&Q);
for (int i=1;i<=n;i++) f[i]=i;
for (int i=1;i<=m;i++){
if (e[i].u>e[i].v) swap(e[i].u,e[i].v);
}
sort(e+1,e+1+m,cmp);
for (int i=1;i<=m;i++) e[i].id=i,T.val[n+i]=e[i].w,T.mx[n+i]=n+i;
sort(e+1,e+1+m);
for (int i=1;i<=Q;i++){
if (q[i].f==2){
if (q[i].x>q[i].y) swap(q[i].x,q[i].y);
int t=find(q[i].x,q[i].y);
//			printf("que%d %d %d\n",t,q[i].x,q[i].y);
e[t].d=1,q[i].id=e[t].id;
}
}
sort(e+1,e+1+m,cmp2);
kruskal();
for (int i=Q;i;i--){
if (q[i].f==1) q[i].ans=T.val[T.query(q[i].x,q[i].y)];
else{
int u=q[i].x,v=q[i].y,k=q[i].id,t=T.query(u,v);
//			printf("%d %d %d %d\n",k,e[k].v,e[k].w,T.val[t]);
if (e[k].w<T.val[t]){
T.cut(e[t-n].u,t),T.cut(e[t-n].v,t);
}