#pragma GCC optimize ("Ofast,unroll-loops,-ffloat-store")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#include    <bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define __unique(V) (V).resize(unique((V).begin(),(V).end())-(V).begin())
#define cntbit(X)   __builtin_popcount((X))
#define bit(S,i) (((S)>>(i))&1)
#define PI	acos(-1)
#define fi  first
#define se  second
#define LL  long long
#define ii  pair<int,int>
#define iii pair<int,ii>
#define eb  emplace_back
#define TASK "1416D"
using namespace std;
const int maxn = 1e5 + 5;
int n,m,q,U[maxn * 3],V[maxn * 3],p[maxn << 1];
int tr[maxn * 5],X[maxn * 5];
int sz[maxn << 1],par[maxn << 1],id[maxn << 1];
bool oke[maxn << 1];
vector <ii> node[maxn * 20];
set <int,greater<int> > mys[maxn << 1];
stack <ii> st;
deque <int> del;
///--------------------------
void    readf(){
    scanf("%d%d%d",&n,&m,&q);
    for(int i = 1; i <= n; ++i) {
        scanf("%d",&p[i]);
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        scanf("%d%d",&U[i],&V[i]);
    for(int i = 1; i <= q; ++i){
        scanf("%d%d",&tr[i],&X[i]);
        if (tr[i] == 2){
            oke[X[i]] = 1;
            del.push_front(X[i]);
        }
    }
}
///--------------------------
inline int root(int u){
    while (u != par[u]) u = par[u];
    return u;
}
///--------------------------
void    join(int u,int v){
    u = root(u); v = root(v);
    if (u == v) return;
    if (sz[u] < sz[v]) swap(u,v);
    for(auto it : mys[v]) mys[u].insert(it);
    st.push(ii(u,sz[u]));
    st.push(ii(v,par[v]));
    sz[u] += sz[v];
    par[v] = u;
}
///--------------------------
void    roll(){
    ii it = st.top(); st.pop();
    int v = it.fi;
    par[v] = it.se;
    it = st.top(); st.pop();
    int u = it.fi;
    sz[u] = it.se;
    for(auto it : mys[v]) mys[u].erase(it);
}
///--------------------------
void    solve(){
    for(int i = 1; i <= n; ++i) par[i] = i, mys[i].insert(p[i]);
    for(int i = 1; i <= m; ++i) if (oke[i] == 0)
        join(U[i],V[i]);
    for(int i : del)
        join(U[i],V[i]);
    for(int i = 1; i <= q; ++i)
    if (tr[i] == 1){
        int u = root(X[i]);
        auto it = mys[u].begin();
        int tmp = (*it);
        printf("%d\n",tmp);
        u = id[tmp];
        mys[u].erase(tmp);
        while (u != par[u]){
            u = par[u];
            mys[u].erase(tmp);
        }
    }else roll();
}
///--------------------------
int     main(){
	srand(time(NULL));
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    #ifdef TLH2203
        freopen(TASK".inp", "r", stdin);
        freopen(TASK".out", "w", stdout);
    #endif // TLH2203
    readf();
    solve();
}


#pragma GCC optimize ("Ofast,unroll-loops,-ffloat-store")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#include    <bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define __unique(V) (V).resize(unique((V).begin(),(V).end())-(V).begin())
#define cntbit(X)   __builtin_popcount((X))
#define bit(S,i) (((S)>>(i))&1)
#define PI	acos(-1)
#define fi  first
#define se  second
#define LL  long long
#define ii  pair<int,int>
#define iii pair<int,ii>
#define eb  emplace_back
#define TASK "1416D"
using namespace std;
const int maxn = 1e5 + 5;
int n,m,q,U[maxn * 3],V[maxn * 3],p[maxn << 1];
int tr[maxn * 5],X[maxn * 5];
int sz[maxn << 1],par[maxn << 1],id[maxn << 1];
bool vis[maxn << 1],oke[maxn << 1];
set <int,greater<int> > mys[maxn << 1];
stack <ii> st;
deque <int> del;
///--------------------------
void    readf(){
    scanf("%d%d%d",&n,&m,&q);
    for(int i = 1; i <= n; ++i) {
        scanf("%d",&p[i]);
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        scanf("%d%d",&U[i],&V[i]);
    for(int i = 1; i <= q; ++i){
        scanf("%d%d",&tr[i],&X[i]);
        if (tr[i] == 2){
            if (X[i] <= 200000)
            oke[X[i]] = 1;
            del.push_front(X[i]);
        }
    }
}
///--------------------------
inline int root(int u){
    while (u != par[u]) u = par[u];
    return u;
}
///--------------------------
void    join(int i,int u,int v){
    u = root(u); v = root(v);
    if (u == v) return;
    vis[i] = 1;
    if (sz[u] < sz[v]) swap(u,v);
    for(auto it : mys[v]) mys[u].insert(it);
    st.push(ii(u,sz[u]));
    st.push(ii(v,par[v]));
    sz[u] += sz[v];
    par[v] = u;
}
///--------------------------
void    roll(int i){
    if (vis[i] == 0) return;
    ii it = st.top(); st.pop();
    int v = it.fi;
    par[v] = it.se;
    it = st.top(); st.pop();
    int u = it.fi;
    sz[u] = it.se;
    for(auto it : mys[v]) mys[u].erase(it);
}
///--------------------------
void    solve(){
    for(int i = 1; i <= n; ++i) par[i] = i, mys[i].insert(p[i]);
    for(int i = 1; i <= m; ++i) if (oke[i] == 0){
        //cerr << i << '\n';
        join(i,U[i],V[i]);
    }
    for(int i : del){
        //cerr << i << '\n';
        join(i,U[i],V[i]);
    }
    for(int i = 1; i <= q; ++i)
    if (tr[i] == 1){
        int u = root(X[i]);
        if (mys[u].size() == 0){
            printf("0\n");
            continue;
        }else{
            int tmp = (*mys[u].begin());
            printf("%d\n",tmp);
            u = id[tmp];
            mys[u].erase(tmp);
            while (u != par[u]){
                u = par[u];
                mys[u].erase(tmp);
            }
        }
    }else roll(X[i]);
}
///--------------------------
int     main(){
	srand(time(NULL));
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    #ifdef TLH2203
        freopen(TASK".inp", "r", stdin);
        freopen(TASK".out", "w", stdout);
    #endif // TLH2203
    readf();
    solve();
}


#pragma GCC optimize ("Ofast,unroll-loops,-ffloat-store")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#include    <bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define __unique(V) (V).resize(unique((V).begin(),(V).end())-(V).begin())
#define cntbit(X)   __builtin_popcount((X))
#define bit(S,i) (((S)>>(i))&1)
#define PI	acos(-1)
#define fi  first
#define se  second
#define LL  long long
#define ii  pair<int,int>
#define iii pair<int,ii>
#define eb  emplace_back
#define TASK "1416D"
using namespace std;
typedef deque <int> DE;
const int maxn = 1e5 + 5;
int n,m,q,U[maxn * 3],V[maxn * 3],p[maxn << 1];
int tr[maxn * 5],X[maxn * 5];
int sz[maxn << 1],par[maxn << 1],id[maxn << 1];
bool vis[maxn * 5],oke[maxn * 3],visted[maxn << 1];
deque <int> mys[maxn << 1];
stack <ii> st;
vector <int> del;
///--------------------------
void    readf(){
    scanf("%d%d%d",&n,&m,&q);
    for(int i = 1; i <= n; ++i) {
        scanf("%d",&p[i]);
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        scanf("%d%d",&U[i],&V[i]);
    for(int i = 1; i <= q; ++i){
        scanf("%d%d",&tr[i],&X[i]);
        if (tr[i] == 2){
            oke[X[i]] = 1;
            del.eb(X[i]);
        }
    }
}
///--------------------------
inline int root(int u){
    while (u != par[u]) u = par[u];
    return u;
}
///--------------------------
DE    merg(DE B,DE C){
    DE A;
    int i = 0, j = 0;
    while (i < B.size() && j < C.size())
        if (B[i] > C[j]) A.eb(B[i++]);
    else A.eb(C[j++]);
    while (i < B.size()) A.eb(B[i++]);
    while (j < C.size()) A.eb(C[j++]);
    return A;
}
///--------------------------
void    join(int i,int u,int v){
    u = root(u); v = root(v);
    if (u == v) return;
    vis[i] = 1;
    if (sz[u] < sz[v]) swap(u,v);
    mys[u] = merg(mys[u],mys[v]);
    if (oke[i] == 1){
        st.push(ii(u,sz[u]));
        st.push(ii(v,par[v]));
    }
    sz[u] += sz[v];
    par[v] = u;
}
///--------------------------
void    roll(int i){
    if (vis[i] == 0) return;
    ii it = st.top(); st.pop();
    int v = it.fi;
    par[v] = it.se;
    it = st.top(); st.pop();
    int u = it.fi;
    sz[u] = it.se;
    for(int it : mys[u]) visted[it] = 0;
    for(int it : mys[v]) visted[it] = 1;
    DE tmp;
    for(int it : mys[u])
        if (visted[it] == 0) tmp.eb(it);
    mys[u] = tmp;
}
///--------------------------
void    solve(){
    for(int i = 1; i <= n; ++i) par[i] = i,sz[i] = 1, mys[i].eb(p[i]);
    for(int i = 1; i <= m; ++i) if (oke[i] == 0){
        //cerr << i << '\n';
        join(i,U[i],V[i]);
    }
    reverse(del.begin(),del.end());
    for(int i : del){
        //cerr << i << '\n';
        join(i,U[i],V[i]);
    }
    for(int i = 1; i <= q; ++i)
    if (tr[i] == 1){
        int u = root(X[i]);
        if (mys[u].size() == 0){
            printf("0\n");
            continue;
        }else{
            int tmp = mys[u][0];
            printf("%d\n",tmp);
            u = id[tmp];
            mys[u].pop_front();
            while (u != par[u]){
                u = par[u];
                mys[u].pop_front();
            }
        }
    }else roll(X[i]);
}
///--------------------------
int     main(){
	srand(time(NULL));
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    #ifdef TLH2203
        freopen(TASK".inp", "r", stdin);
        freopen(TASK".out", "w", stdout);
    #endif // TLH2203
    readf();
    solve();
}


#include <bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define pb push_back
using namespace std;
typedef long long ll;
const int MAXN = (int)5e5 + 5;
const int MAXM = (int)3e5 + 5;
const int MAXQ = (int)5e5 + 5;
const int mod = 1e9 + 7;
int n,m,q,tot;

vector<int>G[MAXN];
int fa[MAXN],boss[MAXQ],op[MAXQ][2],dfn[MAXN],pos[MAXN],p[MAXN],u[MAXN],v[MAXN],sz[MAXN];
bool vis[MAXN];
struct node {int w,pos;}t[MAXN<<2];

int fid(int x){return x==fa[x]?x:fa[x]=fid(fa[x]); }

void dfs(int u) {
	pos[u]=++tot;
	dfn[tot]=u;
	sz[u]=1;
	for(int v:G[u]) dfs(v),sz[u]+=sz[v];
}

void push_up(int rt) {
	if(t[ls].w>t[rs].w) t[rt]=t[ls];
	else t[rt]=t[rs];
}
void build(int rt,int l,int r) {
	t[rt].w=t[rt].pos=0;
	if(l==r) {
		t[rt].w=p[dfn[l]];
		//cout<<l<<','<<t[rt].w<<','<<dfn[l]<<endl;
		t[rt].pos=l;
		return ;
	}
	int mid=l+r>>1;
	build(ls,l,mid);
	build(rs,mid+1,r);
	push_up(rt);
}
void upd(int rt,int l,int r,int z) {
	if(l==r&&r==z) {
		t[rt].w=0;
		return ;
	}
	int mid=l+r>>1;
	if(z<=mid) upd(ls,l,mid,z);
	else upd(rs,mid+1,r,z);
	push_up(rt);
}
node ask(int rt,int l,int r,int ql,int qr)  {//cout<<ql<<','<<qr<<endl;
	if(ql<=l&&r<=qr) return t[rt];
	int mid=l+r>>1;
	node f1,f2;
	f1.w=f2.w=f1.pos=f2.pos=0;
	if(ql<=mid) f1=ask(ls,l,mid,ql,qr);
	if(qr>mid) f2=ask(rs,mid+1,r,ql,qr);
	if(f1.w>f2.w) return f1;
	else return f2;
}
int main() {
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;i++) {
    	scanf("%d",&p[i]);
    }
    for(int i=1;i<=m;i++) {
    	scanf("%d%d",&u[i],&v[i]);
    }
    for(int i=1;i<=q;i++) {
    	scanf("%d%d",&op[i][0],&op[i][1]);
    	if(op[i][0]==2) vis[op[i][1]]=1;
    }
    for(int i=1;i<=n+q;i++) fa[i]=i;
    for(int i=1;i<=m;i++) {
    	if(vis[i]) continue;
    	//cout<<i<<endl;
    	int fx=fid(u[i]),fy=fid(v[i]);
    	if(fx!=fy) {
    		fa[fx]=fy;
    		G[fy].pb(fx);
    	}
    }

    //for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;
    for(int i=q;i>=1;i--) {
    	if(op[i][0]==2) {
    		int x=op[i][1];
    		int fx=fid(u[x]),fy=fid(v[x]);
    		if(fx!=fy) {
    			n++;
    			G[n].pb(fx);
    			G[n].pb(fy);
    			fa[fx]=n;
    			fa[fy]=n;
    			//cout<<i<<endl;
    		}

    	} else boss[i]=fid(op[i][1]);
    }
	//for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;return 0;
    for(int i=1;i<=n;i++) {
    	if(!dfn[pos[i]]) {
    		cout<<i<<'_'<<fid(i)<<endl;
    		dfs(fid(i));
    	}
    }    //return 0;
    build(1,1,tot);
/*    cout<<tot<<',';
    for(int i=1;i<=tot;i++) printf("%d ",dfn[i]);
    printf("\n");*/

    for(int i=1;i<=q;i++) {
    	if(op[i][0]==1) {//cout<<boss[i]<<','<<pos[boss[i]]+sz[boss[i]]-1<<endl;
    		node x=ask(1,1,tot,pos[boss[i]],pos[boss[i]]+sz[boss[i]]-1);
    		//
    		if(x.w>0) upd(1,1,tot,x.pos);
    		printf("%d\n",x.w);
    	}
    }
    return 0;
}


#include <bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define pb push_back
using namespace std;
typedef long long ll;
const int MAXN = (int)5e5 + 5;
const int MAXM = (int)3e5 + 5;
const int MAXQ = (int)5e5 + 5;
const int mod = 1e9 + 7;
int n,m,q,tot;

vector<int>G[MAXN];
int fa[MAXN],boss[MAXQ],op[MAXQ][2],dfn[MAXN],pos[MAXN],p[MAXN],u[MAXN],v[MAXN],sz[MAXN];
bool vis[MAXN];
struct node {int w,pos;}t[MAXN<<2];

int fid(int x){return x==fa[x]?x:fa[x]=fid(fa[x]); }

void dfs(int u) {
	pos[u]=++tot;
	dfn[tot]=u;
	sz[u]=1;
	for(int v:G[u]) dfs(v),sz[u]+=sz[v];
}

void push_up(int rt) {
	if(t[ls].w>t[rs].w) t[rt]=t[ls];
	else t[rt]=t[rs];
}
void build(int rt,int l,int r) {
	t[rt].w=t[rt].pos=0;
	if(l==r) {
		t[rt].w=p[dfn[l]];
		//cout<<l<<','<<t[rt].w<<','<<dfn[l]<<endl;
		t[rt].pos=l;
		return ;
	}
	int mid=l+r>>1;
	build(ls,l,mid);
	build(rs,mid+1,r);
	push_up(rt);
}
void upd(int rt,int l,int r,int z) {
	if(l==r&&r==z) {
		t[rt].w=0;
		return ;
	}
	int mid=l+r>>1;
	if(z<=mid) upd(ls,l,mid,z);
	else upd(rs,mid+1,r,z);
	push_up(rt);
}
node ask(int rt,int l,int r,int ql,int qr)  {
	if(ql<=l&&r<=qr) return t[rt];
	int mid=l+r>>1;
	node f1,f2;
	f1.w=f2.w=f1.pos=f2.pos=0;
	if(ql<=mid) f1=ask(ls,l,mid,ql,qr);
	if(qr>mid) f2=ask(rs,mid+1,r,ql,qr);
	if(f1.w>f2.w) return f1;
	else return f2;
}
int main() {

    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;i++) {
    	scanf("%d",&p[i]);
    }
    for(int i=1;i<=m;i++) {
    	scanf("%d%d",&u[i],&v[i]);
    }
    for(int i=1;i<=q;i++) {
    	scanf("%d%d",&op[i][0],&op[i][1]);
    	if(op[i][0]==2) vis[op[i][1]]=1;
    }
    for(int i=1;i<=n+q;i++) fa[i]=i;
    for(int i=1;i<=m;i++) {
    	if(vis[i]) continue;
    	//cout<<i<<endl;
    	int fx=fid(u[i]),fy=fid(v[i]);
    	if(fx!=fy) {
    		fa[fx]=fy;
    		G[fy].pb(fx);
    	}
    }

    //for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;
    for(int i=q;i>=1;i--) {
    	if(op[i][0]==2) {
    		int x=op[i][1];
    		int fx=fid(u[x]),fy=fid(v[x]);
    		if(fx!=fy) {
    			n++;
    			G[n].pb(fx);
    			G[n].pb(fy);
    			fa[fx]=n;
    			fa[fy]=n;
    			//cout<<i<<endl;
    		}

    	} else boss[i]=fid(op[i][1]);
    }
	//for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;
    for(int i=1;i<=n;i++) {
    	if(!dfn[i]) {
    		//cout<<i<<'_'<<fid(i)<<endl;
    		dfs(fid(i));
    	}
    }
    build(1,1,tot);
/*    cout<<tot<<',';
    for(int i=1;i<=tot;i++) printf("%d ",dfn[i]);
    printf("\n");*/

    for(int i=1;i<=q;i++) {
    	if(op[i][0]==1) {
    		node x=ask(1,1,tot,pos[boss[i]],pos[boss[i]]+sz[boss[i]]-1);
    		//cout<<pos[boss[i]]<<','<<pos[boss[i]]+sz[boss[i]]-1<<endl;
    		if(x.w>0) upd(1,1,tot,x.pos);
    		printf("%d\n",x.w);
    	}
    }
    return 0;
}


#include <bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define pb push_back
using namespace std;
typedef long long ll;
const int maxn = 7e5 + 5;
const int mod = 1e9 + 7;

int n,m,q;
int p[maxn],u[300010],v[300010],vis[300010],fa[maxn],op[500010][2],sz[maxn],boss[500010];
int pos[maxn],dfn[maxn],tot;
struct node {int w,pos;}t[maxn<<2];
vector<int>G[maxn];
int fid(int x){return x==fa[x]?x:fa[x]=fid(fa[x]); }

void dfs(int u) {
	pos[u]=++tot;
	dfn[tot]=u;
	sz[u]=1;
	for(int v:G[u]) dfs(v),sz[u]+=sz[v];
}

void push_up(int rt) {
	if(t[ls].w>t[rs].w) t[rt]=t[ls];
	else t[rt]=t[rs];
}
void build(int rt,int l,int r) {
	t[rt].w=t[rt].pos=0;
	if(l==r) {
		t[rt].w=p[dfn[l]];
		//cout<<l<<','<<t[rt].w<<','<<dfn[l]<<endl;
		t[rt].pos=l;
		return ;
	}
	int mid=l+r>>1;
	build(ls,l,mid);
	build(rs,mid+1,r);
	push_up(rt);
}
void upd(int rt,int l,int r,int z) {
	if(l==r&&r==z) {
		t[rt].w=0;
		return ;
	}
	int mid=l+r>>1;
	if(z<=mid) upd(ls,l,mid,z);
	else upd(rs,mid+1,r,z);
	push_up(rt);
}
node ask(int rt,int l,int r,int ql,int qr)  {//cout<<ql<<','<<qr<<endl;
	if(ql<=l&&r<=qr) return t[rt];
	int mid=l+r>>1;
	node f1,f2;
	f1.w=f2.w=f1.pos=f2.pos=0;
	if(ql<=mid) f1=ask(ls,l,mid,ql,qr);
	if(qr>mid) f2=ask(rs,mid+1,r,ql,qr);
	if(f1.w>f2.w) return f1;
	else return f2;
}
int main() {
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;i++) {
    	scanf("%d",&p[i]);
    }
    for(int i=1;i<=m;i++) {
    	scanf("%d%d",&u[i],&v[i]);
    }
    for(int i=1;i<=q;i++) {
    	scanf("%d%d",&op[i][0],&op[i][1]);
    	if(op[i][0]==2) vis[op[i][1]]=1;
    }
    for(int i=1;i<=n+q;i++) fa[i]=i;
    for(int i=1;i<=m;i++) {
    	if(vis[i]) continue;
    	//cout<<i<<endl;
    	int fx=fid(u[i]),fy=fid(v[i]);
    	if(fx!=fy) {
    		fa[fx]=fy;
    		G[fy].pb(fx);
    	}
    }

    //for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;
    for(int i=q;i>=1;i--) {
    	if(op[i][0]==2) {
    		int x=op[i][1];
    		int fx=fid(u[x]),fy=fid(v[x]);
    		if(fx!=fy) {
    			n++;
    			G[n].pb(fx);
    			G[n].pb(fy);
    			fa[fx]=n;
    			fa[fy]=n;
    			//cout<<i<<endl;
    		}

    	} else boss[i]=fid(op[i][1]);
    }
	//for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;return 0;
    for(int i=1;i<=n;i++) {
    	if(!dfn[pos[i]]) {
    		//cout<<i<<'_'<<fid(i)<<endl;
    		dfs(fid(i));
    	}
    }    //return 0;
    build(1,1,tot);
/*    cout<<tot<<',';
    for(int i=1;i<=tot;i++) printf("%d ",dfn[i]);
    printf("\n");*/

    for(int i=1;i<=q;i++) {
    	if(op[i][0]==1) {
    		node x=ask(1,1,tot,pos[boss[i]],pos[boss[i]]+sz[boss[i]]-1);
    		//
    		if(x.w>0) upd(1,1,tot,x.pos);
    		printf("%d\n",x.w);
    	}
    }
    return 0;
}


#include <bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define pb push_back
using namespace std;
typedef long long ll;
const int maxn = 7e5 + 5;
const int mod = 1e9 + 7;
int n,m,q;
int p[maxn],u[200010],v[200010],vis[300010],fa[maxn],op[500010][2],sz[maxn],boss[500010];
int pos[maxn],dfn[maxn],tot;

int fid(int x){return x==fa[x]?x:fa[x]=fid(fa[x]); }

vector<int>G[maxn];
void dfs(int u) {
	pos[u]=++tot;
	dfn[tot]=u;
	sz[u]=1;
	//cout<<u<<','<<tot<<endl;
	for(int v:G[u]) dfs(v),sz[u]+=sz[v];
}
struct node {int w,pos;}t[maxn<<2];

void push_up(int rt) {
	if(t[ls].w>t[rs].w) t[rt]=t[ls];
	else t[rt]=t[rs];
}
void build(int rt,int l,int r) {
	t[rt].w=t[rt].pos=0;
	if(l==r) {
		t[rt].w=p[dfn[l]];
		//cout<<l<<','<<t[rt].w<<','<<dfn[l]<<endl;
		t[rt].pos=l;
		return ;
	}
	int mid=l+r>>1;
	build(ls,l,mid);
	build(rs,mid+1,r);
	push_up(rt);
}
void upd(int rt,int l,int r,int z) {
	if(l==r&&r==z) {
		t[rt].w=0;
		return ;
	}
	int mid=l+r>>1;
	if(z<=mid) upd(ls,l,mid,z);
	else upd(rs,mid+1,r,z);
	push_up(rt);
}
node ask(int rt,int l,int r,int ql,int qr)  {
	if(ql<=l&&r<=qr) return t[rt];
	int mid=l+r>>1;
	node f1,f2;
	f1.w=f2.w=f1.pos=f2.pos=0;
	if(ql<=mid) f1=ask(ls,l,mid,ql,qr);
	if(qr>mid) f2=ask(rs,mid+1,r,ql,qr);
	if(f1.w>f2.w) return f1;
	else return f2;
}
int main() {

    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;i++) {
    	scanf("%d",&p[i]);
    }
    for(int i=1;i<=m;i++) {
    	scanf("%d%d",&u[i],&v[i]);
    }
    for(int i=1;i<=q;i++) {
    	scanf("%d%d",&op[i][0],&op[i][1]);
    	if(op[i][0]==2) vis[op[i][1]]=1;
    }
    for(int i=1;i<=n+q;i++) fa[i]=i;
    for(int i=1;i<=m;i++) {
    	if(vis[i]) continue;
    	//cout<<i<<endl;
    	int fx=fid(u[i]),fy=fid(v[i]);
    	if(fx!=fy) {
    		fa[fx]=fy;
    		G[fy].pb(fx);
    	}
    }

    //for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;
    for(int i=q;i>=1;i--) {
    	if(op[i][0]==2) {
    		int x=op[i][1];
    		int fx=fid(u[x]),fy=fid(v[x]);
    		if(fx!=fy) {
    			n++;
    			G[n].pb(fx);
    			G[n].pb(fy);
    			fa[fx]=n;
    			fa[fy]=n;
    			//cout<<i<<endl;
    		}

    	} else boss[i]=fid(op[i][1]);
    }
	//for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;
    for(int i=1;i<=n;i++) {
    	if(!dfn[i]) {
    		//cout<<i<<'_'<<fid(i)<<endl;
    		dfs(fid(i));
    	}
    }
    build(1,1,tot);
/*    cout<<tot<<',';
    for(int i=1;i<=tot;i++) printf("%d ",dfn[i]);
    printf("\n");*/

    for(int i=1;i<=q;i++) {
    	if(op[i][0]==1) {
    		node x=ask(1,1,tot,pos[boss[i]],pos[boss[i]]+sz[boss[i]]-1);
    		//cout<<pos[boss[i]]<<','<<pos[boss[i]]+sz[boss[i]]-1<<endl;
    		if(x.w>0) upd(1,1,tot,x.pos);
    		printf("%d\n",x.w);
    	}
    }
    return 0;
}


#include <bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define pb push_back
using namespace std;
typedef long long ll;
const int MAXN = (int)5e5 + 5;
const int MAXM = (int)3e5 + 5;
const int MAXQ = (int)5e5 + 5;
const int mod = 1e9 + 7;
int n,m,q,tot;

vector<int>G[MAXN];
int fa[MAXN],boss[MAXQ],op[MAXQ][2],dfn[MAXN],pos[MAXN],p[MAXN],u[MAXN],v[MAXN],sz[MAXN];
bool vis[MAXN];
struct node {int w,pos;}t[MAXN<<2];

int fid(int x){return x==fa[x]?x:fa[x]=fid(fa[x]); }

void dfs(int u) {
	pos[u]=++tot;
	dfn[tot]=u;
	sz[u]=1;
	for(int v:G[u]) dfs(v),sz[u]+=sz[v];
}

void push_up(int rt) {
	if(t[ls].w>t[rs].w) t[rt]=t[ls];
	else t[rt]=t[rs];
}
void build(int rt,int l,int r) {
	t[rt].w=t[rt].pos=0;
	if(l==r) {
		t[rt].w=p[dfn[l]];
		//cout<<l<<','<<t[rt].w<<','<<dfn[l]<<endl;
		t[rt].pos=l;
		return ;
	}
	int mid=l+r>>1;
	build(ls,l,mid);
	build(rs,mid+1,r);
	push_up(rt);
}
void upd(int rt,int l,int r,int z) {
	if(l==r&&r==z) {
		t[rt].w=0;
		return ;
	}
	int mid=l+r>>1;
	if(z<=mid) upd(ls,l,mid,z);
	else upd(rs,mid+1,r,z);
	push_up(rt);
}
node ask(int rt,int l,int r,int ql,int qr)  {//cout<<ql<<','<<qr<<endl;
	if(ql<=l&&r<=qr) return t[rt];
	int mid=l+r>>1;
	node f1,f2;
	f1.w=f2.w=f1.pos=f2.pos=0;
	if(ql<=mid) f1=ask(ls,l,mid,ql,qr);
	if(qr>mid) f2=ask(rs,mid+1,r,ql,qr);
	if(f1.w>f2.w) return f1;
	else return f2;
}
int main() {
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;i++) {
    	scanf("%d",&p[i]);
    }
    for(int i=1;i<=m;i++) {
    	scanf("%d%d",&u[i],&v[i]);
    }
    for(int i=1;i<=q;i++) {
    	scanf("%d%d",&op[i][0],&op[i][1]);
    	if(op[i][0]==2) vis[op[i][1]]=1;
    }
    for(int i=1;i<=n+q;i++) fa[i]=i;
    for(int i=1;i<=m;i++) {
    	if(vis[i]) continue;
    	//cout<<i<<endl;
    	int fx=fid(u[i]),fy=fid(v[i]);
    	if(fx!=fy) {
    		fa[fx]=fy;
    		G[fy].pb(fx);
    	}
    }

    //for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;
    for(int i=q;i>=1;i--) {
    	if(op[i][0]==2) {
    		int x=op[i][1];
    		int fx=fid(u[x]),fy=fid(v[x]);
    		if(fx!=fy) {
    			n++;
    			G[n].pb(fx);
    			G[n].pb(fy);
    			fa[fx]=n;
    			fa[fy]=n;
    			//cout<<i<<endl;
    		}

    	} else boss[i]=fid(op[i][1]);
    }
	//for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;return 0;
    for(int i=1;i<=n;i++) {
    	if(!dfn[pos[i]]) {
    		//cout<<i<<'_'<<fid(i)<<endl;
    		dfs(fid(i));
    	}
    }    //return 0;
    build(1,1,tot);
/*    cout<<tot<<',';
    for(int i=1;i<=tot;i++) printf("%d ",dfn[i]);
    printf("\n");*/

    for(int i=1;i<=q;i++) {
    	if(op[i][0]==1) {//cout<<boss[i]<<','<<pos[boss[i]]+sz[boss[i]]-1<<endl;
    		node x=ask(1,1,tot,pos[boss[i]],pos[boss[i]]+sz[boss[i]]-1);
    		//
    		if(x.w>0) upd(1,1,tot,x.pos);
    		printf("%d\n",x.w);
    	}
    }
    return 0;
}


#include <bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define pb push_back
using namespace std;
typedef long long ll;
const int maxn = 7e5 + 5;
const int mod = 1e9 + 7;
int n,m,q;
int p[maxn],u[200010],v[200010],vis[300010],fa[maxn],op[500010][2],sz[maxn],boss[500010];
int pos[maxn],dfn[maxn],tot;
struct node {int w,pos;}t[maxn<<2];
vector<int>G[maxn];
int fid(int x){return x==fa[x]?x:fa[x]=fid(fa[x]); }

void dfs(int u) {
	pos[u]=++tot;
	dfn[tot]=u;
	sz[u]=1;
	for(int v:G[u]) dfs(v),sz[u]+=sz[v];
}

void push_up(int rt) {
	if(t[ls].w>t[rs].w) t[rt]=t[ls];
	else t[rt]=t[rs];
}
void build(int rt,int l,int r) {
	t[rt].w=t[rt].pos=0;
	if(l==r) {
		t[rt].w=p[dfn[l]];
		//cout<<l<<','<<t[rt].w<<','<<dfn[l]<<endl;
		t[rt].pos=l;
		return ;
	}
	int mid=l+r>>1;
	build(ls,l,mid);
	build(rs,mid+1,r);
	push_up(rt);
}
void upd(int rt,int l,int r,int z) {
	if(l==r&&r==z) {
		t[rt].w=0;
		return ;
	}
	int mid=l+r>>1;
	if(z<=mid) upd(ls,l,mid,z);
	else upd(rs,mid+1,r,z);
	push_up(rt);
}
node ask(int rt,int l,int r,int ql,int qr)  {//cout<<ql<<','<<qr<<endl;
	if(ql<=l&&r<=qr) return t[rt];
	int mid=l+r>>1;
	node f1,f2;
	f1.w=f2.w=f1.pos=f2.pos=0;
	if(ql<=mid) f1=ask(ls,l,mid,ql,qr);
	if(qr>mid) f2=ask(rs,mid+1,r,ql,qr);
	if(f1.w>f2.w) return f1;
	else return f2;
}
int main() {
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;i++) {
    	scanf("%d",&p[i]);
    }
    for(int i=1;i<=m;i++) {
    	scanf("%d%d",&u[i],&v[i]);
    }
    for(int i=1;i<=q;i++) {
    	scanf("%d%d",&op[i][0],&op[i][1]);
    	if(op[i][0]==2) vis[op[i][1]]=1;
    }
    for(int i=1;i<=n+q;i++) fa[i]=i;
    for(int i=1;i<=m;i++) {
    	if(vis[i]) continue;
    	//cout<<i<<endl;
    	int fx=fid(u[i]),fy=fid(v[i]);
    	if(fx!=fy) {
    		fa[fx]=fy;
    		G[fy].pb(fx);
    	}
    }

    //for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;
    for(int i=q;i>=1;i--) {
    	if(op[i][0]==2) {
    		int x=op[i][1];
    		int fx=fid(u[x]),fy=fid(v[x]);
    		if(fx!=fy) {
    			n++;
    			G[n].pb(fx);
    			G[n].pb(fy);
    			fa[fx]=n;
    			fa[fy]=n;
    			//cout<<i<<endl;
    		}

    	} else boss[i]=fid(op[i][1]);
    }
	//for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;return 0;
    for(int i=1;i<=n;i++) {
    	if(!dfn[pos[i]]) {
    		//cout<<i<<'_'<<fid(i)<<endl;
    		dfs(fid(i));
    	}
    }    //return 0;
    build(1,1,tot);
/*    cout<<tot<<',';
    for(int i=1;i<=tot;i++) printf("%d ",dfn[i]);
    printf("\n");*/

    for(int i=1;i<=q;i++) {
    	if(op[i][0]==1) {//cout<<boss[i]<<','<<pos[boss[i]]+sz[boss[i]]-1<<endl;
    		node x=ask(1,1,tot,pos[boss[i]],pos[boss[i]]+sz[boss[i]]-1);
    		//
    		if(x.w>0) upd(1,1,tot,x.pos);
    		printf("%d\n",x.w);
    	}
    }
    return 0;
}


#include <bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define pb push_back
using namespace std;
typedef long long ll;
const int maxn = 7e5 + 5;
const int mod = 1e9 + 7;

int n,m,q;
int p[maxn],u[200010],v[200010],vis[300010],fa[maxn],op[500010][2],sz[maxn],boss[500010];
int pos[maxn],dfn[maxn],tot;
struct node {int w,pos;}t[maxn<<2];
vector<int>G[maxn];
int fid(int x){return x==fa[x]?x:fa[x]=fid(fa[x]); }

void dfs(int u) {
	pos[u]=++tot;
	dfn[tot]=u;
	sz[u]=1;
	for(int v:G[u]) dfs(v),sz[u]+=sz[v];
}

void push_up(int rt) {
	if(t[ls].w>t[rs].w) t[rt]=t[ls];
	else t[rt]=t[rs];
}
void build(int rt,int l,int r) {
	t[rt].w=t[rt].pos=0;
	if(l==r) {
		t[rt].w=p[dfn[l]];
		//cout<<l<<','<<t[rt].w<<','<<dfn[l]<<endl;
		t[rt].pos=l;
		return ;
	}
	int mid=l+r>>1;
	build(ls,l,mid);
	build(rs,mid+1,r);
	push_up(rt);
}
void upd(int rt,int l,int r,int z) {
	if(l==r&&r==z) {
		t[rt].w=0;
		return ;
	}
	int mid=l+r>>1;
	if(z<=mid) upd(ls,l,mid,z);
	else upd(rs,mid+1,r,z);
	push_up(rt);
}
node ask(int rt,int l,int r,int ql,int qr)  {//cout<<ql<<','<<qr<<endl;
	if(ql<=l&&r<=qr) return t[rt];
	int mid=l+r>>1;
	node f1,f2;
	f1.w=f2.w=f1.pos=f2.pos=0;
	if(ql<=mid) f1=ask(ls,l,mid,ql,qr);
	if(qr>mid) f2=ask(rs,mid+1,r,ql,qr);
	if(f1.w>f2.w) return f1;
	else return f2;
}
int main() {
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;i++) {
    	scanf("%d",&p[i]);
    }
    for(int i=1;i<=m;i++) {
    	scanf("%d%d",&u[i],&v[i]);
    }
    for(int i=1;i<=q;i++) {
    	scanf("%d%d",&op[i][0],&op[i][1]);
    	if(op[i][0]==2) vis[op[i][1]]=1;
    }
    for(int i=1;i<=n+q;i++) fa[i]=i;
    for(int i=1;i<=m;i++) {
    	if(vis[i]) continue;
    	//cout<<i<<endl;
    	int fx=fid(u[i]),fy=fid(v[i]);
    	if(fx!=fy) {
    		n++;
			G[n].pb(fx);
			G[n].pb(fy);
			fa[fx]=n;
			fa[fy]=n;
    	}
    }

    //for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;
    for(int i=q;i>=1;i--) {
    	if(op[i][0]==2) {
    		int x=op[i][1];
    		int fx=fid(u[x]),fy=fid(v[x]);
    		if(fx!=fy) {
    			n++;
    			G[n].pb(fx);
    			G[n].pb(fy);
    			fa[fx]=n;
    			fa[fy]=n;
    			//cout<<i<<endl;
    		}

    	} else boss[i]=fid(op[i][1]);
    }
	//for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;return 0;
    for(int i=1;i<=n;i++) {
    	if(!dfn[pos[i]]) {
    		//cout<<i<<'_'<<fid(i)<<endl;
    		dfs(fid(i));
    	}
    }    //return 0;
    build(1,1,tot);
/*    cout<<tot<<',';
    for(int i=1;i<=tot;i++) printf("%d ",dfn[i]);
    printf("\n");*/

    for(int i=1;i<=q;i++) {
    	if(op[i][0]==1) {
    		node x=ask(1,1,tot,pos[boss[i]],pos[boss[i]]+sz[boss[i]]-1);
    		//
    		if(x.w>0) upd(1,1,tot,x.pos);
    		printf("%d\n",x.w);
    	}
    }
    return 0;
}


#include <bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define pb push_back
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
int n,m,q;
int p[maxn],u[maxn],v[maxn],vis[maxn],fa[maxn],op[maxn][2],sz[maxn],boss[maxn];
int pos[maxn],dfn[maxn],tot;

int fid(int x){return x==fa[x]?x:fa[x]=fid(fa[x]); }

vector<int>G[maxn];
void dfs(int u) {
	pos[u]=++tot;
	dfn[tot]=u;
	sz[u]=1;
	//cout<<u<<','<<tot<<endl;
	for(int v:G[u]) dfs(v),sz[u]+=sz[v];
}
struct node {int w,pos;}t[maxn<<2];

void push_up(int rt) {
	if(t[ls].w>t[rs].w) t[rt]=t[ls];
	else t[rt]=t[rs];
}
void build(int rt,int l,int r) {
	t[rt].w=t[rt].pos=0;
	if(l==r) {
		t[rt].w=p[dfn[l]];
		//cout<<l<<','<<t[rt].w<<','<<dfn[l]<<endl;
		t[rt].pos=l;
		return ;
	}
	int mid=l+r>>1;
	build(ls,l,mid);
	build(rs,mid+1,r);
	push_up(rt);
}
void upd(int rt,int l,int r,int z) {
	if(l==r&&r==z) {
		t[rt].w=0;
		return ;
	}
	int mid=l+r>>1;
	if(z<=mid) upd(ls,l,mid,z);
	else upd(rs,mid+1,r,z);
	push_up(rt);
}
node ask(int rt,int l,int r,int ql,int qr)  {
	if(ql<=l&&r<=qr) return t[rt];
	int mid=l+r>>1;
	node f1,f2;
	f1.w=f2.w=f1.pos=f2.pos=0;
	if(ql<=mid) f1=ask(ls,l,mid,ql,qr);
	if(qr>mid) f2=ask(rs,mid+1,r,ql,qr);
	if(f1.w>f2.w) return f1;
	else return f2;
}
int main() {

    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;i++) {
    	scanf("%d",&p[i]);
    }
    for(int i=1;i<=m;i++) {
    	scanf("%d%d",&u[i],&v[i]);
    }
    for(int i=1;i<=q;i++) {
    	scanf("%d%d",&op[i][0],&op[i][1]);
    	if(op[i][0]==2) vis[op[i][1]]=1;
    }
    for(int i=1;i<=n+q;i++) fa[i]=i;
    for(int i=1;i<=m;i++) {
    	if(vis[i]) continue;
    	//cout<<i<<endl;
    	int fx=fid(u[i]),fy=fid(v[i]);
    	if(fx!=fy) {
    		fa[fx]=fy;
    		G[fy].pb(fx);
    	}
    }

    //for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;
    for(int i=q;i>=1;i--) {
    	if(op[i][0]==2) {
    		int x=op[i][1];
    		int fx=fid(u[x]),fy=fid(v[x]);
    		if(fx!=fy) {
    			n++;
    			G[n].pb(fx);
    			G[n].pb(fy);
    			fa[fx]=n;
    			fa[fy]=n;
    			//cout<<i<<endl;
    		}

    	} else boss[i]=fid(op[i][1]);
    }
	//for(int i=1;i<=n;i++) cout<<fid(i)<<',';cout<<endl;
    for(int i=1;i<=n;i++) {
    	if(!dfn[i]) {
    		//cout<<i<<'_'<<fid(i)<<endl;
    		dfs(fid(i));
    	}
    }
    build(1,1,tot);
/*    cout<<tot<<',';
    for(int i=1;i<=tot;i++) printf("%d ",dfn[i]);
    printf("\n");*/

    for(int i=1;i<=q;i++) {
    	if(op[i][0]==1) {
    		node x=ask(1,1,tot,pos[boss[i]],pos[boss[i]]+sz[boss[i]]-1);
    		//cout<<pos[boss[i]]<<','<<pos[boss[i]]+sz[boss[i]]-1<<endl;
    		if(x.w>0) upd(1,1,tot,x.pos);
    		printf("%d\n",x.w);
    	}
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=550005;
int n,m,Q;
int p[N],ex[N],ey[N];
int T[N],tp[N],qv[N];
int key[N],fa[N],f[N][20];
int dfn[N],ed[N],pos[N],id[N];
vector<int> e[N],op[N];
int get(int x){
	return x==fa[x]?x:fa[x]=get(fa[x]);
}
bool cmp(int x,int y){
	return T[x]>T[y];
}
void dfs(int x){
	dfn[x]=++*dfn;
	pos[*dfn]=x;
	for (auto i:e[x]) dfs(i);
	//cout<<x<<' '<<dfn[x]<<' '<<ed[x]<<endl;
	ed[x]=*dfn;
}
int findP(int x,int p){
	Rep(i,18,0)
		if (key[f[x][i]]>=p)
			x=f[x][i];
	return x;
}

pii t[N*4];
void build(int k,int l,int r){
	if (l==r){
		t[k]=pii(p[pos[l]],l);
		return;
	}
	int mid=(l+r)/2;
	build(k*2,l,mid);
	build(k*2+1,mid+1,r);
	t[k]=max(t[k*2],t[k*2+1]);
}
void change(int k,int l,int r,int p){
	if (l==r){
		t[k]=pii(0,0);
		return;
	}
	int mid=(l+r)/2;
	if (p<=mid) change(k*2,l,mid,p);
	else change(k*2+1,mid+1,r,p);
	t[k]=max(t[k*2],t[k*2+1]);
}
pii ask(int k,int l,int r,int x,int y){
	if (l==x&&r==y)
		return t[k];
	int mid=(l+r)/2;
	if (y<=mid) return ask(k*2,l,mid,x,y);
	if (x>mid) return ask(k*2+1,mid+1,r,x,y);
	return max(ask(k*2,l,mid,x,mid),ask(k*2+1,mid+1,r,mid+1,y));
}

int main(){
	freopen("1.in","r",stdin);
	scanf("%d%d%d",&n,&m,&Q);
	For(i,1,n) scanf("%d",&p[i]);
	For(i,1,m) scanf("%d%d",&ex[i],&ey[i]),T[i]=Q+1;
	For(i,1,Q){
		scanf("%d%d",&tp[i],&qv[i]);
		if (tp[i]==2) T[qv[i]]=i;
	}
	For(i,1,m) op[T[i]].PB(i);
	For(i,1,m) id[i]=i;
	sort(id+1,id+m+1,cmp);
	int nd=n;
	For(i,1,n) fa[i]=i;
	For(i,1,m){
		int x=id[i];
		int p1=get(ex[x]);
		int p2=get(ey[x]);
		//cout<<p1<<' '<<p2<<endl;
		if (p1!=p2){
			key[++nd]=T[x];
			fa[p1]=fa[p2]=fa[nd]=nd;
			f[p1][0]=f[p2][0]=nd;
			e[nd].PB(p1); e[nd].PB(p2);
			//cout<<nd<<' '<<p1<<' '<<p2<<endl;
		}
	}
	For(i,1,18) For(j,1,nd)
		f[j][i]=f[f[j][i-1]][i-1];
	For(i,1,nd)
		if (!f[i][0])
			dfs(i);
	//For(i,1,nd)
	//	cout<<dfn[i]<<' '<<ed[i]<<' '<<f[i][0]<<endl;
	build(1,1,nd);
	For(i,1,Q)
		if (tp[i]==1){
			//for (int j=qv[i];j;j=f[j][0]) cerr<<j<<' '<<key[j]<<endl;
			int p=findP(qv[i],i);
			//cout<<p<<' '<<key[p]<<endl;
			pii res=ask(1,1,nd,dfn[p],ed[p]);
			change(1,1,nd,res.se);
			printf("%d\n",res.fi);
		}
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=500005;
int n,m,Q;
int p[N],ex[N],ey[N];
int T[N],tp[N],qv[N];
int key[N],fa[N],f[N][20];
int dfn[N],ed[N],pos[N],id[N];
vector<int> e[N],op[N];
int get(int x){
	return x==fa[x]?x:fa[x]=get(fa[x]);
}
bool cmp(int x,int y){
	return T[x]>T[y];
}
void dfs(int x){
	dfn[x]=++*dfn;
	pos[*dfn]=x;
	for (auto i:e[x]) dfs(i);
	//cout<<x<<' '<<dfn[x]<<' '<<ed[x]<<endl;
	ed[x]=*dfn;
}
int findP(int x,int p){
	Rep(i,18,0)
		if (key[f[x][i]]>=p)
			x=f[x][i];
	return x;
}

pii t[N*4];
void build(int k,int l,int r){
	if (l==r){
		t[k]=pii(p[pos[l]],l);
		return;
	}
	int mid=(l+r)/2;
	build(k*2,l,mid);
	build(k*2+1,mid+1,r);
	t[k]=max(t[k*2],t[k*2+1]);
}
void change(int k,int l,int r,int p){
	if (l==r){
		t[k]=pii(0,l);
		return;
	}
	int mid=(l+r)/2;
	if (p<=mid) change(k*2,l,mid,p);
	else change(k*2+1,mid+1,r,p);
	t[k]=max(t[k*2],t[k*2+1]);
}
pii ask(int k,int l,int r,int x,int y){
	if (l==x&&r==y)
		return t[k];
	int mid=(l+r)/2;
	if (y<=mid) return ask(k*2,l,mid,x,y);
	if (x>mid) return ask(k*2+1,mid+1,r,x,y);
	return max(ask(k*2,l,mid,x,mid),ask(k*2+1,mid+1,r,mid+1,y));
}

int main(){
	scanf("%d%d%d",&n,&m,&Q);
	For(i,1,n) scanf("%d",&p[i]);
	For(i,1,m) scanf("%d%d",&ex[i],&ey[i]),T[i]=Q+1;
	For(i,1,Q){
		scanf("%d%d",&tp[i],&qv[i]);
		if (tp[i]==2) T[qv[i]]=i;
	}
	For(i,1,m) op[T[i]].PB(i);
	For(i,1,m) id[i]=i;
	sort(id+1,id+m+1,cmp);
	int nd=n;
	For(i,1,n) fa[i]=i;
	For(i,1,m){
		int x=id[i];
		int p1=get(ex[x]);
		int p2=get(ey[x]);
		//cout<<p1<<' '<<p2<<endl;
		if (p1!=p2){
			key[++nd]=T[x];
			fa[p1]=fa[p2]=fa[nd]=nd;
			f[p1][0]=f[p2][0]=nd;
			e[nd].PB(p1); e[nd].PB(p2);
			//cout<<nd<<' '<<p1<<' '<<p2<<endl;
		}
	}
	For(i,1,18) For(j,1,nd)
		f[j][i]=f[f[j][i-1]][i-1];
	For(i,1,nd)
		if (!f[i][0])
			dfs(i);
	//For(i,1,nd)
	//	cout<<dfn[i]<<' '<<ed[i]<<' '<<f[i][0]<<endl;
	build(1,1,nd);
	For(i,1,Q)
		if (tp[i]==1){
			//for (int j=qv[i];j;j=f[j][0]) cerr<<j<<' '<<key[j]<<endl;
			int p=findP(qv[i],i);
			//cout<<p<<' '<<key[p]<<endl;
			pii res=ask(1,1,nd,dfn[p],ed[p]);
			change(1,1,nd,res.se);
			printf("%d\n",res.fi);
		}
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=800005;
int n,m,Q;
int p[N],ex[N],ey[N];
int T[N],tp[N],qv[N];
int key[N],fa[N],f[N][20];
int dfn[N],ed[N],pos[N],id[N];
vector<int> e[N],op[N];
int get(int x){
	return x==fa[x]?x:fa[x]=get(fa[x]);
}
bool cmp(int x,int y){
	return T[x]>T[y];
}
void dfs(int x){
	dfn[x]=++*dfn;
	pos[*dfn]=x;
	for (auto i:e[x]) dfs(i);
	//cout<<x<<' '<<dfn[x]<<' '<<ed[x]<<endl;
	ed[x]=*dfn;
}
int findP(int x,int p){
	Rep(i,18,0)
		if (key[f[x][i]]>=p)
			x=f[x][i];
	return x;
}

pii t[N*4];
void build(int k,int l,int r){
	if (l==r){
		t[k]=pii(p[pos[l]],l);
		return;
	}
	int mid=(l+r)/2;
	build(k*2,l,mid);
	build(k*2+1,mid+1,r);
	t[k]=max(t[k*2],t[k*2+1]);
}
void change(int k,int l,int r,int p){
	if (l==r){
		t[k]=pii(0,0);
		return;
	}
	int mid=(l+r)/2;
	if (p<=mid) change(k*2,l,mid,p);
	else change(k*2+1,mid+1,r,p);
	t[k]=max(t[k*2],t[k*2+1]);
}
pii ask(int k,int l,int r,int x,int y){
	if (l==x&&r==y)
		return t[k];
	int mid=(l+r)/2;
	if (y<=mid) return ask(k*2,l,mid,x,y);
	if (x>mid) return ask(k*2+1,mid+1,r,x,y);
	return max(ask(k*2,l,mid,x,mid),ask(k*2+1,mid+1,r,mid+1,y));
}

int main(){
	freopen("1.in","r",stdin);
	scanf("%d%d%d",&n,&m,&Q);
	For(i,1,n) scanf("%d",&p[i]);
	For(i,1,m) scanf("%d%d",&ex[i],&ey[i]),T[i]=Q+1;
	For(i,1,Q){
		scanf("%d%d",&tp[i],&qv[i]);
		if (tp[i]==2) T[qv[i]]=i;
	}
	For(i,1,m) op[T[i]].PB(i);
	For(i,1,m) id[i]=i;
	sort(id+1,id+m+1,cmp);
	int nd=n;
	For(i,1,n) fa[i]=i;
	For(i,1,m){
		int x=id[i];
		int p1=get(ex[x]);
		int p2=get(ey[x]);
		//cout<<p1<<' '<<p2<<endl;
		if (p1!=p2){
			key[++nd]=T[x];
			fa[p1]=fa[p2]=fa[nd]=nd;
			f[p1][0]=f[p2][0]=nd;
			e[nd].PB(p1); e[nd].PB(p2);
			//cout<<nd<<' '<<p1<<' '<<p2<<endl;
		}
	}
	For(i,1,19) For(j,1,nd)
		f[j][i]=f[f[j][i-1]][i-1];
	For(i,1,nd)
		if (!f[i][0])
			dfs(i);
	//For(i,1,nd)
	//	cout<<dfn[i]<<' '<<ed[i]<<' '<<f[i][0]<<endl;
	build(1,1,nd);
	For(i,1,Q)
		if (tp[i]==1){
			//for (int j=qv[i];j;j=f[j][0]) cerr<<j<<' '<<key[j]<<endl;
			int p=findP(qv[i],i);
			//cout<<p<<' '<<key[p]<<endl;
			pii res=ask(1,1,nd,dfn[p],ed[p]);
			change(1,1,nd,res.se);
			printf("%d\n",res.fi);
		}
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=500005;
int n,m,Q;
int p[N],ex[N],ey[N];
int T[N],tp[N],qv[N];
int key[N],fa[N],f[N][20];
int dfn[N],ed[N],pos[N],id[N];
vector<int> e[N],op[N];
int get(int x){
	return x==fa[x]?x:fa[x]=get(fa[x]);
}
bool cmp(int x,int y){
	return T[x]>T[y];
}
void dfs(int x){
	dfn[x]=++*dfn;
	pos[*dfn]=x;
	for (auto i:e[x]) dfs(i);
	//cout<<x<<' '<<dfn[x]<<' '<<ed[x]<<endl;
	ed[x]=*dfn;
}
int findP(int x,int p){
	Rep(i,18,0)
		if (key[f[x][i]]>=p)
			x=f[x][i];
	return x;
}

pii t[N*4];
void build(int k,int l,int r){
	if (l==r){
		t[k]=pii(p[pos[l]],l);
		return;
	}
	int mid=(l+r)/2;
	build(k*2,l,mid);
	build(k*2+1,mid+1,r);
	t[k]=max(t[k*2],t[k*2+1]);
}
void change(int k,int l,int r,int p){
	if (l==r){
		t[k]=pii(0,0);
		return;
	}
	int mid=(l+r)/2;
	if (p<=mid) change(k*2,l,mid,p);
	else change(k*2+1,mid+1,r,p);
	t[k]=max(t[k*2],t[k*2+1]);
}
pii ask(int k,int l,int r,int x,int y){
	if (l==x&&r==y)
		return t[k];
	int mid=(l+r)/2;
	if (y<=mid) return ask(k*2,l,mid,x,y);
	if (x>mid) return ask(k*2+1,mid+1,r,x,y);
	return max(ask(k*2,l,mid,x,mid),ask(k*2+1,mid+1,r,mid+1,y));
}

int main(){
	//freopen("1.in","r",stdin);
	scanf("%d%d%d",&n,&m,&Q);
	For(i,1,n) scanf("%d",&p[i]);
	For(i,1,m) scanf("%d%d",&ex[i],&ey[i]),T[i]=Q+1;
	For(i,1,Q){
		scanf("%d%d",&tp[i],&qv[i]);
		if (tp[i]==2) T[qv[i]]=i;
	}
	For(i,1,m) op[T[i]].PB(i);
	For(i,1,m) id[i]=i;
	sort(id+1,id+m+1,cmp);
	int nd=n;
	For(i,1,n) fa[i]=i;
	For(i,1,m){
		int x=id[i];
		int p1=get(ex[x]);
		int p2=get(ey[x]);
		//cout<<p1<<' '<<p2<<endl;
		if (p1!=p2){
			key[++nd]=T[x];
			fa[p1]=fa[p2]=fa[nd]=nd;
			f[p1][0]=f[p2][0]=nd;
			e[nd].PB(p1); e[nd].PB(p2);
			//cout<<nd<<' '<<p1<<' '<<p2<<endl;
		}
	}
	For(i,1,18) For(j,1,nd)
		f[j][i]=f[f[j][i-1]][i-1];
	For(i,1,nd)
		if (!f[i][0])
			dfs(i);
	//For(i,1,nd)
	//	cout<<dfn[i]<<' '<<ed[i]<<' '<<f[i][0]<<endl;
	build(1,1,nd);
	For(i,1,Q)
		if (tp[i]==1){
			//for (int j=qv[i];j;j=f[j][0]) cerr<<j<<' '<<key[j]<<endl;
			int p=findP(qv[i],i);
			//cout<<p<<' '<<key[p]<<endl;
			pii res=ask(1,1,nd,dfn[p],ed[p]);
			change(1,1,nd,res.se);
			printf("%d\n",res.fi);
		}
}


#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>

namespace FastIn {

template <class T>
inline void readInt(T &w) {
  char c, p = 0;
  while (!isdigit(c = getchar())) p = c == '-';
  for (w = c & 15; isdigit(c = getchar()); w = w * 10 + (c & 15));
  if (p) w = -w;
}
template <class T, class... Args>
inline void readInt(T &w, Args &... args) { readInt(w), readInt(args...); }
}  // namespace FastIn
using namespace FastIn;
template <class T, class U>
inline bool smin(T &x, const U &y) {
  return y < x ? x = y, 1 : 0;
}
template <class T, class U>
inline bool smax(T &x, const U &y) {
  return x < y ? x = y, 1 : 0;
}

constexpr int N(2e5 + 5), M(5e5 + 5);
int n, m, q, a[N];
std::pair<int, int> e[M], qry[M];

namespace UFS {
int fa[N];
inline int find(int x) {
  return fa[x] ? fa[x] = find(fa[x]) : x;
}
} // namespace UFS

bool deleted[M];

int in[N], out[N];
namespace NRTreap {
struct Node {
  int ls, rs, fa, r, w, m;
} t[N];
inline void pushup(int o) {
  t[o].m = o;
  if (t[t[t[o].ls].m].w > t[o].w) t[o].m = t[t[o].ls].m;
  if (t[t[t[o].rs].m].w > t[t[o].m].w) t[o].m = t[t[o].rs].m;
  t[t[o].ls].fa = t[t[o].rs].fa = o;
}
void split(int o, int k, int &x, int &y) {
  if (!o) {
    x = y = 0;
    return;
  }
  if (k < o) {
    split(t[o].ls, k, x, t[o].ls);
    y = o;
  } else {
    split(t[o].rs, k, t[o].rs, y);
    x = o;
  }
  t[x].fa = t[y].fa = 0;
  pushup(o);
}
int merge(int x, int y) {
  if (!x || !y) return x | y;
  return t[x].r < t[y].r ? (t[x].rs = merge(t[x].rs, y), pushup(x), x)
                         : (t[y].ls = merge(x, t[y].ls), pushup(y), y);
}
void solve() {
  for (int i = 1; i <= q; i++) {
    auto [z, x] = qry[i];
    if (z == 1) {
      x = in[x];
      while (t[x].fa) x = t[x].fa;
      printf("%d\n", t[t[x].m].w);
    } else {
      if (deleted[x]) continue;
      auto [u, v] = e[x];
      int l = in[u], r = out[u];
      u = l;
      while (t[u].fa) u = t[u].fa;
      int a, b, c;
      split(u, l - 1, a, b);
      split(b, r, b, c);
      merge(a, c);
    }
  }
}
} // namespace NRTreap

namespace Tree {
std::vector<int> g[N];
inline void addEdge(int x, int y) {
  g[x].push_back(y), g[y].push_back(x);
}
int idx, fa[N], rt;
void dfs(int x) {
  in[x] = ++idx;
  NRTreap::t[idx] = { 0, 0, 0, rand(), a[x], idx };
  rt = NRTreap::merge(rt, idx);
  for (int y : g[x])
    if (!in[y])
      fa[y] = x, dfs(y);
  out[x] = idx;
}
void init() {
  for (int i = 1; i <= n; i++)
    if (!in[i]) dfs(i);
  for (int i = 1; i <= m; i++) {
    if (deleted[i]) continue;
    auto &[x, y] = e[i];
    if (fa[x] != y) std::swap(x, y);
    if (fa[x] != y) puts("ERR!");
  }
}
} // namespace Tree

int main() {
  readInt(n, m, q);
  for (int i = 1; i <= n; i++)
    readInt(a[i]);
  for (int i = 1; i <= m; i++)
    readInt(e[i].first, e[i].second);
  for (int i = 1; i <= q; i++) {
    readInt(qry[i].first, qry[i].second);
    if (qry[i].first == 2)
      deleted[qry[i].second] = 1;
  }
  using namespace UFS;
  for (int i = 1; i <= m; i++) {
    if (deleted[i]) continue;
    int x = find(e[i].first), y = find(e[i].second);
    if (x != y) {
      fa[x] = y;
      Tree::addEdge(e[i].first, e[i].second);
    }
  }
  for (int i = q; i; i--) {
    if (qry[i].first == 1) continue;
    auto &u = e[qry[i].second];
    int x = find(u.first), y = find(u.second);
    if (x != y) {
      deleted[qry[i].second] = 0;
      fa[x] = y;
      Tree::addEdge(u.first, u.second);
    }
  }
  Tree::init();
  NRTreap::solve();
  return 0;
}


#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>

namespace FastIn {

template <class T>
inline void readInt(T &w) {
  char c, p = 0;
  while (!isdigit(c = getchar())) p = c == '-';
  for (w = c & 15; isdigit(c = getchar()); w = w * 10 + (c & 15));
  if (p) w = -w;
}
template <class T, class... Args>
inline void readInt(T &w, Args &... args) { readInt(w), readInt(args...); }
}  // namespace FastIn
using namespace FastIn;
template <class T, class U>
inline bool smin(T &x, const U &y) {
  return y < x ? x = y, 1 : 0;
}
template <class T, class U>
inline bool smax(T &x, const U &y) {
  return x < y ? x = y, 1 : 0;
}

constexpr int N(2e5 + 5), M(5e5 + 5);
int n, m, q, a[N];
std::pair<int, int> e[M], qry[M];

namespace UFS {
int fa[N];
inline int find(int x) {
  return fa[x] ? fa[x] = find(fa[x]) : x;
}
} // namespace UFS

bool deleted[M];

namespace NRTreap {
struct Node {
  int ls, rs, fa, r, w, m;
} t[N];
inline void pushup(int o) {
  t[o].m = o;
  if (t[t[t[o].ls].m].w > t[o].w) t[o].m = t[t[o].ls].m;
  if (t[t[t[o].rs].m].w > t[t[o].m].w) t[o].m = t[t[o].rs].m;
  t[t[o].ls].fa = t[t[o].rs].fa = o;
}
void split(int o, int k, int &x, int &y) {
  if (!o) {
    x = y = 0;
    return;
  }
  if (k < o) {
    split(t[o].ls, k, x, t[o].ls);
    y = o;
  } else {
    split(t[o].rs, k, t[o].rs, y);
    x = o;
  }
  t[x].fa = t[y].fa = 0;
  pushup(o);
}
int merge(int x, int y) {
  if (!x || !y) return x | y;
  return t[x].r < t[y].r ? (t[x].rs = merge(t[x].rs, y), pushup(x), x)
                         : (t[y].ls = merge(x, t[y].ls), pushup(y), y);
}
void solve() {
  for (int i = 1; i <= q; i++) {
    auto [z, x] = qry[i];
    if (z == 1) {
      x = Tree::in[x];
      while (t[x].fa) x = t[x].fa;
      printf("%d\n", t[t[x].m].w);
    } else {
      if (deleted[x]) continue;
      auto [u, v] = e[x];
      if (Tree::fa[u] != v) std::swap(u, v);
      int l = Tree::in[u], r = Tree::out[u];
      u = l;
      while (t[u].fa) u = t[u].fa;
      int a, b, c;
      split(u, l - 1, a, b);
      split(b, r, b, c);
      merge(a, c);
    }
  }
}
} // namespace NRTreap

namespace Tree {
std::vector<int> g[N];
inline void addEdge(int x, int y) {
  g[x].push_back(y), g[y].push_back(x);
}
int in[N], out[N], idx, fa[N], rt;
void dfs(int x) {
  in[x] = ++idx;
  NRTreap::t[idx] = { 0, 0, 0, rand(), a[x], idx };
  rt = NRTreap::merge(rt, idx);
  for (int y : g[x])
    if (!in[y])
      fa[y] = x, dfs(y);
  out[x] = idx;
}
void init() {
  for (int i = 1; i <= n; i++)
    if (!in[i]) dfs(i);
}
} // namespace Tree

int main() {
  readInt(n, m, q);
  for (int i = 1; i <= n; i++)
    readInt(a[i]);
  for (int i = 1; i <= m; i++)
    readInt(e[i].first, e[i].second);
  for (int i = 1; i <= q; i++) {
    readInt(qry[i].first, qry[i].second);
    if (qry[i].first == 2)
      deleted[qry[i].second] = 1;
  }
  using namespace UFS;
  for (int i = 1; i <= m; i++) {
    if (deleted[i]) continue;
    int x = find(e[i].first), y = find(e[i].second);
    if (x != y) {
      fa[x] = y;
      Tree::addEdge(e[i].first, e[i].second);
    }
  }
  for (int i = q; i; i--) {
    if (qry[i].first == 1) continue;
    auto &u = e[qry[i].second];
    int x = find(u.first), y = find(u.second);
    if (x != y) {
      deleted[qry[i].second] = 0;
      fa[x] = y;
      Tree::addEdge(u.first, u.second);
    }
  }
  Tree::init();
  NRTreap::solve();
  return 0;
}


#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>

namespace FastIn {

template <class T>
inline void readInt(T &w) {
  char c, p = 0;
  while (!isdigit(c = getchar())) p = c == '-';
  for (w = c & 15; isdigit(c = getchar()); w = w * 10 + (c & 15));
  if (p) w = -w;
}
template <class T, class... Args>
inline void readInt(T &w, Args &... args) { readInt(w), readInt(args...); }
}  // namespace FastIn
using namespace FastIn;
template <class T, class U>
inline bool smin(T &x, const U &y) {
  return y < x ? x = y, 1 : 0;
}
template <class T, class U>
inline bool smax(T &x, const U &y) {
  return x < y ? x = y, 1 : 0;
}

constexpr int N(2e5 + 5), M(5e5 + 5);
int n, m, q, a[N];
std::pair<int, int> e[M], qry[M];

namespace UFS {
int fa[N];
inline int find(int x) {
  return fa[x] ? fa[x] = find(fa[x]) : x;
}
} // namespace UFS

bool deleted[M];

int in[N], out[N];
namespace NRTreap {
struct Node {
  int ls, rs, fa, r, w, m;
} t[N];
inline void pushup(int o) {
  t[o].m = o;
  if (t[t[t[o].ls].m].w > t[o].w) t[o].m = t[t[o].ls].m;
  if (t[t[t[o].rs].m].w > t[t[o].m].w) t[o].m = t[t[o].rs].m;
  t[t[o].ls].fa = t[t[o].rs].fa = o;
}
void split(int o, int k, int &x, int &y) {
  if (!o) {
    x = y = 0;
    return;
  }
  if (k < o) {
    split(t[o].ls, k, x, t[o].ls);
    y = o;
  } else {
    split(t[o].rs, k, t[o].rs, y);
    x = o;
  }
  t[x].fa = t[y].fa = 0;
  pushup(o);
}
int merge(int x, int y) {
  if (!x || !y) return x | y;
  return t[x].r < t[y].r ? (t[x].rs = merge(t[x].rs, y), pushup(x), x)
                         : (t[y].ls = merge(x, t[y].ls), pushup(y), y);
}

// void dfs(int x) {
//   if (!x) return;
//   dfs(t[x].ls);
//   printf("%d ", x);
//   dfs(t[x].rs);
// }
void solve() {
  for (int i = 1; i <= q; i++) {
    auto [z, x] = qry[i];
    if (z == 1) {
      x = in[x];
      while (t[x].fa) x = t[x].fa;
      x = t[x].m;
      printf("%d\n", t[x].w);
      t[x].w = 0;
      while (x) pushup(x), x = t[x].fa;
    } else {
      if (deleted[x]) continue;
      auto [u, v] = e[x];
      int l = in[u], r = out[u];
      u = l;
      while (t[u].fa) u = t[u].fa;
      int a, b, c;
      split(u, l - 1, a, b);
      split(b, r, b, c);
      merge(a, c);
    }
  }
}
} // namespace NRTreap

namespace Tree {
std::vector<int> g[N];
inline void addEdge(int x, int y) {
  g[x].push_back(y), g[y].push_back(x);
}
int idx, fa[N], rt;
void dfs(int x) {
  in[x] = ++idx;
  // printf("%d: %d\n", idx, x);
  NRTreap::t[idx] = { 0, 0, 0, rand(), a[x], idx };
  rt = NRTreap::merge(rt, idx);
  for (int y : g[x])
    if (!in[y])
      fa[y] = x, dfs(y);
  out[x] = idx;
}
void init() {
  for (int i = 1; i <= n; i++)
    if (!in[i]) rt = 0, dfs(i);
  for (int i = 1; i <= m; i++) {
    if (deleted[i]) continue;
    auto &[x, y] = e[i];
    if (fa[x] != y) std::swap(x, y);
  }
}
} // namespace Tree

int main() {
  readInt(n, m, q);
  for (int i = 1; i <= n; i++)
    readInt(a[i]);
  for (int i = 1; i <= m; i++)
    readInt(e[i].first, e[i].second);
  for (int i = 1; i <= q; i++) {
    readInt(qry[i].first, qry[i].second);
    if (qry[i].first == 2)
      deleted[qry[i].second] = 1;
  }
  using namespace UFS;
  for (int i = 1; i <= m; i++) {
    if (deleted[i]) continue;
    int x = find(e[i].first), y = find(e[i].second);
    if (x != y) {
      fa[x] = y;
      Tree::addEdge(e[i].first, e[i].second);
    }
  }
  for (int i = q; i; i--) {
    if (qry[i].first == 1) continue;
    auto &u = e[qry[i].second];
    int x = find(u.first), y = find(u.second);
    if (x != y) {
      deleted[qry[i].second] = 0;
      fa[x] = y;
      Tree::addEdge(u.first, u.second);
    }
  }
  Tree::init();
  NRTreap::solve();
  return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef long long ll;
#define f first
#define s second
#define endl '\n'
#define all(x) x.begin(),x.end()
const int N=5e5+1;
int p[ N ],tin [ N ],tout[ N ],timer=0;
int get( int v ){
    return p[v] = ( v == p[v] ? v : get( p[ v ] ) );
}
int n,m,q;
vector<int> g [ N ];
pii t[ 4 * N ];
int a[ N ];
int obr[N];
void mg(int a, int b){
    int c = get( a ), d = get( b );
    n++;
    p[c]=n;
    p[d]=n;
    g[ n ].emplace_back(c);
    g[ n ].emplace_back(d);
    return ;
}
void dfs(int v, int p){
    tin[ v ] = ++timer;
    obr[ timer ] = v;
    for(auto &z : g[ v ]){
        dfs( z, v );
    }
    tout[ v ] = timer;
}
void b_tr(int v,int tl,int tr){
    if(tl == tr){
        t[v]={a[obr[tl]],tl};
    }
    else{
        int tm=(tl+tr)>>1;
        b_tr(2*v,tl,tm);
        b_tr(2*v+1,tm+1,tr);
        t[v]=max(t[2*v],t[2*v+1]);
    }
}
pii getMax(int l,int r,int v,int tl,int tr){
    if(tl>=l && tr<=r){
        return t[v];
    }
    if(tl>r || tr<l) return {0,n};
    int tm=(tl+tr)>>1;
    return max(getMax(l,r,2*v,tl,tm),getMax(l,r,2*v+1,tm+1,tr));
}
void upd(int id,int v,int tl,int tr){
    if(tl==tr){
        t[v].first=0;
        return ;
    }
    int tm=(tl+tr)>>1;
    if(tm>=id)
        upd(id,2*v,tl,tm);
    else
        upd(id,2*v+1,tm+1,tr);
    t[v]=max(t[2*v],t[2*v+1]);
}
pii e[N];
bool ex[N];
pii qe[N];
signed main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i = 0;i < m;i++){
        int v,u;
        cin>>v>>u;
        e[i]={v,u};
    }
    iota(p,p+N,0);
    for(int i = 0;i < q;i++){
        int tp;
        cin>>tp;
        int id;
        cin>>id;
        if(tp==2){
            ex[id-1]=1;
        }
        qe[i]={tp,id};
    }
    for(int i = 0; i < m;i++){
        if(!ex[i]){
            mg(e[i].f,e[i].s);
        }
    }
    for(int i = q - 1; ~ i; --i){
        if(qe[i].f==2)
            mg(e[qe[i].s-1].f,e[qe[i].s-1].s);
        else {
            qe[i].s=get(qe[i].s);
        }
    }
    for(int i = 1;i <= n; i++){
        if(get(i)==i)
            dfs(i,i);
    }
    b_tr(1,1,N-1);
    for(int i = 0; i<q; i++){
        if(qe[i].f==1){
            int id=qe[i].s;
            auto w=getMax(tin[id],tout[id],1,1,N-1);
            upd(w.s,1,1,N-1);
            cout<<w.f<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef long long ll;
#define f first
#define s second
#define endl '\n'
#define all(x) x.begin(),x.end()
const int N=5e5+1;
int p[ N ],tin [ N ],tout[ N ],timer=0;
int get( int v ){
    return p[v] = ( v == p[v] ? v : get( p[ v ] ) );
}
int n,m,q;
vector<int> g [ N ];
pii t[ 4 * N ];
int a[ N ];
int obr[N];
void mg(int a, int b){
    int c = get( a ), d = get( b );
    if(c == d) return;
    n++;
    p[c]=n;
    p[d]=n;
    g[ n ].emplace_back(c);
    g[ n ].emplace_back(d);
    return ;
}
void dfs(int v, int p){
    tin[ v ] = ++timer;
    obr[ timer ] = v;
    for(auto &z : g[ v ]){
        dfs( z, v );
    }
    tout[ v ] = timer;
}
void b_tr(int v,int tl,int tr){
    if(tl == tr){
        t[v]={a[obr[tl]],tl};
    }
    else{
        int tm=(tl+tr)>>1;
        b_tr(2*v,tl,tm);
        b_tr(2*v+1,tm+1,tr);
        t[v]=max(t[2*v],t[2*v+1]);
    }
}
pii getMax(int l,int r,int v,int tl,int tr){
    if(tl>=l && tr<=r){
        return t[v];
    }
    if(tl>r || tr<l) return {0,n};
    int tm=(tl+tr)>>1;
    return max(getMax(l,r,2*v,tl,tm),getMax(l,r,2*v+1,tm+1,tr));
}
void upd(int id,int v,int tl,int tr){
    if(tl==tr){
        t[v].first=0;
        return ;
    }
    int tm=(tl+tr)>>1;
    if(tm>=id)
        upd(id,2*v,tl,tm);
    else
        upd(id,2*v+1,tm+1,tr);
    t[v]=max(t[2*v],t[2*v+1]);
}
pii e[N];
bool ex[N];
pii qe[N];
signed main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i = 0;i < m;i++){
        int v,u;
        cin>>v>>u;
        e[i]={v,u};
    }
    iota(p,p+N,0);
    for(int i = 0;i < q;i++){
        int tp;
        cin>>tp;
        int id;
        cin>>id;
        if(tp==2){
            ex[id-1]=1;
        }
        qe[i]={tp,id};
    }
    for(int i = 0; i < m;i++){
        if(!ex[i]){
            mg(e[i].f,e[i].s);
        }
    }
    for(int i = q - 1; ~ i; --i){
        if(qe[i].f==2)
            mg(e[qe[i].s-1].f,e[qe[i].s-1].s);
        else {
            qe[i].s=get(qe[i].s);
        }
    }
    for(int i = 1;i <= n; i++){
        if(get(i)==i)
            dfs(i,i);
    }
    b_tr(1,1,N-1);
    for(int i = 0; i<q; i++){
        if(qe[i].f==1){
            int id=qe[i].s;
            auto w=getMax(tin[id],tout[id],1,1,N-1);
            upd(w.s,1,1,N-1);
            cout<<w.f<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef long long ll;
#define f first
#define s second
#define endl '\n'
#define all(x) x.begin(),x.end()
const int N=5e5+1;
int p[ N ],tin [ N ],tout[ N ],timer=0;
int get( int v ){
    return p[v] = ( v == p[v] ? v : get( p[ v ] ) );
}
int n,m,q;
vector<int> g [ N ];
pii t[ 4 * N ];
int a[ N ];
int obr[N];
void mg(int a, int b){
    int c = get( a ), d = get( b );
    n++;
//    debug()<<imie(n);
    p[c]=n;
    p[d]=n;
    g[ n ].emplace_back(c);
    g[ n ].emplace_back(d);
    return ;
}
bool us[N];
void dfs(int v, int p){
    timer++;
    us[v]=1;
//    debug()<<imie(v)<<imie(timer);
    tin[ v ] = timer;
    obr[ timer ] = v;
    for(auto &z : g[ v ]){
        if(!us[z])dfs( z, v );
    }
    tout[ v ] = timer;
}
void b_tr(int v,int tl,int tr){
    if(tl == tr){
        t[v]={a[obr[tl]],tl};
    }
    else{
        int tm=(tl+tr)>>1;
        b_tr(2*v,tl,tm);
        b_tr(2*v+1,tm+1,tr);
        t[v]=max(t[2*v],t[2*v+1]);
    }
}
pii getMax(int l,int r,int v,int tl,int tr){
    if(tl>=l && tr<=r){
        return t[v];
    }
    if(tl>r || tr<l) return {0,n};
    int tm=(tl+tr)>>1;
    return max(getMax(l,r,2*v,tl,tm),getMax(l,r,2*v+1,tm+1,tr));
}
void upd(int id,int v,int tl,int tr){
    if(tl==tr){
        t[v].first=0;
        return ;
    }
    int tm=(tl+tr)>>1;
    if(tm>=id)
        upd(id,2*v,tl,tm);
    else
        upd(id,2*v+1,tm+1,tr);
    t[v]=max(t[2*v],t[2*v+1]);
}
pii e[N];
bool ex[N];
pii qe[N];
signed main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i = 0;i < m;i++){
        int v,u;
        cin>>v>>u;
        e[i]={v,u};
    }
    iota(p,p+N,0);
    for(int i = 0;i < q;i++){
        int tp;
        cin>>tp;
        int id;
        cin>>id;
        if(tp==2){
            ex[id-1]=1;
        }
        qe[i]={tp,id};
    }
    for(int i = 0; i < m;i++){
        if(!ex[i]){
            mg(e[i].f,e[i].s);
        }
    }
    for(int i = q - 1; ~ i; --i){
        if(qe[i].f==2)
            mg(e[qe[i].s-1].f,e[qe[i].s-1].s);
        else {
            qe[i].s=get(qe[i].s);
//            debug()<<imie(qe[i].s);
        }
    }
    for(int i = 1;i <= n; i++){
        if(get(i)==i)
            dfs(i,i);
//        cout<<endl;
    }
    assert(n==timer);
//    debug()<<imie(n)imie(timer);
    b_tr(1,1,timer);
    for(int i = 0; i<q; i++){
        if(qe[i].f==1){
            int id=qe[i].s;
            auto w=getMax(tin[id],tout[id],1,1,timer);
            upd(w.s,1,1,timer);
            cout<<w.f<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef long long ll;
#define f first
#define s second
#define endl '\n'
#define all(x) x.begin(),x.end()
const int N=5e5+1;
int p[ N ],tin [ N ],tout[ N ],timer;
int get( int v ){
    return p[v] = ( v == p[v] ? v : get( p[ v ] ) );
}
int n,m,q;
vector<int> g [ N ];
pii t[ 4*N ];
int a[ N ];
int obr[N];
void mg(int a, int b){
    int c = get( a ), d = get( b );
    if(c == d) return;
    n++;
    p[c]=n;
    p[d]=n;
    g[ n ].emplace_back(c);
    g[ n ].emplace_back(d);
    return ;
}
void dfs(int v, int p){
    tin[ v ] = timer++;
    obr[ timer - 1 ] = v;
    for(auto &z : g[ v ]){
//        if(z == p) continue;
        dfs( z, v );
    }
    tout[ v ] = timer - 1;
}
void b_tr(int v,int tl,int tr){
    if(tl == tr){
        t[v]={a[obr[tl]],tl};
    }
    else{
        int tm=(tl+tr)>>1;
        b_tr(2*v,tl,tm);
        b_tr(2*v+1,tm+1,tr);
        t[v]=max(t[2*v],t[2*v+1]);
    }
}
pii getMax(int l,int r,int v,int tl,int tr){
    if(tl>=l && tr<=r){
        return t[v];
    }
    if(tl>r || tr<l) return {0,n};
    int tm=(tl+tr)>>1;
    return max(getMax(l,r,2*v,tl,tm),getMax(l,r,2*v+1,tm+1,tr));
}
void upd(int id,int v,int tl,int tr){
    if(tl==tr){
        t[v].first=0;
        return ;
    }
    int tm=(tl+tr)>>1;
    if(tm>=id)
        upd(id,2*v,tl,tm);
    else
        upd(id,2*v+1,tm+1,tr);
    t[v]=max(t[2*v],t[2*v+1]);
}
pii e[N];
bool ex[N];
pii qe[N];
signed main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i = 0;i < m;i++){
        int v,u;
        cin>>v>>u;
        e[i]={v,u};
    }
    iota(p,p+N,0);
    for(int i = 0;i < q;i++){
        int tp;
        cin>>tp;
        int id;
        cin>>id;
        if(tp==2){
            ex[id-1]=1;
        }
        qe[i]={tp,id};
    }
    for(int i = 0; i < m;i++){
        if(!ex[i]){
            mg(e[i].f,e[i].s);
//            for(int i = 1;i <= n; i++){
//                debug()<<imie(get(i));
//            }
//            cout<<endl;
        }
    }
    for(int i = q - 1; ~ i; --i){
        if(qe[i].f==2)
            mg(e[qe[i].s-1].f,e[qe[i].s-1].s);
        else {

//            debug()<<imie(qe[i].s)imie(get(qe[i].s));
            qe[i].s=get(qe[i].s);
        }
    }
    for(int i = 1;i <= n; i++){
        if(get(i)==i)
            dfs(i,i);
    }
    b_tr(1,1,n);
//    for(int i = 1;i <= n; i++){
//        debug()<<imie(tin[i])imie(tout[i])imie(getMax(tin[i],tin[i],1,1,n))imie(a[i]);
//    }
//    vector<int> ans;
    for(int i = i=0; i<q; i++){
        if(qe[i].f==1){
            int id=qe[i].s;
            auto w=getMax(tin[id],tout[id],1,1,n);
            upd(w.s,1,1,n);
//            debug()<<imie(w)imie(id);
            cout<<w.f<<endl;
        }
    }
//    reverse(all(ans));
//    for(auto &z : ans) cout<<z<<endl;
    return 0;
}


#include <bits/stdc++.h>
//#include "race.h"
//    #pragma GCC optimize("-O3")
//    #pragma GCC optimize("no-stack-protector")
//    #pragma GCC optimize("fast-math")
//    #pragma GCC optimize("Ofast")
//    #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//    #pragma GCC target("avx,avx2,fma")
//    #pragma GCC optimization ("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fi first
#define f first
#define s second
#define se second
#define vec vector
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define sz(x) (int)x.size()
#define pw(x) (1ll<<x)
#define p_b push_back
#define m_p make_pair
#define fast_io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define sq(x) (x)*(x)
//#define int long long
using namespace std;
using namespace __gnu_pbds;
typedef pair<long long, long long> PII;
typedef pair<int, int> pii;
typedef long double ld;
typedef long long ll;
typedef pair<long long, long long > pll;
template <typename T> umax(T &a, T b){return (a<b ? a=b,1 : 0);}
template <typename T> umin(T &a, T b){return (a>b ? a=b,1 : 0);}
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> o_set;
const int N=5e5+5;
const ll inf=1e9;
const ld eps = 1e-9;
const int ppp=73;
const int M=99999837;
const ll tx[4]={-1,1,0,0};
const ll ty[4]={0,0,-1,1};
const char rev_to[4]={'U','D','L','R'};
auto rnd=bind(uniform_int_distribution<ll>(1,1e9),mt19937(time(0)));
int n,m,q;
int p[N],in[N],out[N],obr[N],t;
vec<int> g[N];
void make(int v){
    p[v]=v;
}
int get(int v){
    return p[v]=(p[v]==v?v:get(p[v]));
}
void mg(int a,int b){
    int c=get(a),d=get(b);
    if(c==d){
        return;
    }
    p[c]=++n;
    p[d]=n;
    g[n].pb(c);
    g[n].pb(d);
}
struct seg{
    pii t[4*N];
    void init(){
        fill(t,t+4*N,m_p(0,0));
    }
    void upd(int v,int tl,int tr,int id, pii vl){
        if(tl==tr){
            t[v]=vl;
            return;
        }
        int tm=(tl+tr)>>1;
        if(tm>=id)
            upd(2*v,tl,tm,id,vl);
        else
            upd(2*v+1,tm+1,tr,id,vl);
        t[v]=max(t[2*v],t[2*v+1]);
    }
    pii get(int l,int r,int v,int tl,int tr){
        if(tl>=l && tr<=r){
            return t[v];
        }
        if(tl>r || tr<l){
            return {0,0};
        }
        int tm=(tl+tr)>>1;
        return max(get(l,r,2*v,tl,tm),
                   get(l,r,2*v+1,tm+1,tr));
    }
}Do;
int a[N];
pii e[N];
bool used[N];
void dfs(int v){
    in[v]=++t;
    obr[t]=v;
    for(auto &z : g[v]){
        if(!in[z])
            dfs(z);
    }
    out[v]=t;
}
signed main()
{
    fast_io;
    cin>>n>>m>>q;
    for(int i = 1; i<=n;i++){
        cin>>a[i];
    }
    for(int i = 0 ; i < m; ++i){
        int v,u;
        cin>>v>>u;
        e[i]={v,u};
    }
    vec<pii>zapr(q);
    for(int i = 0; i < q; ++i){
        cin>>zapr[i].f>>zapr[i].s;
        if(zapr[i].f==1){

        }
        else{
            zapr[i].s--;
            used[zapr[i].s]=1;
        }
    }
    for(int i = 1; i < N; ++i)
        make(i);
    for(int i = 0 ;i < m; ++i){
        if(!used[i])
            mg(e[i].f,e[i].s);
    }
    for(int i = q - 1 ; ~i; --i){
        if(zapr[i].f==1){
            int x=get(zapr[i].s);
            zapr[i].s=x;
        }
        else{
            mg(e[zapr[i].s].f,e[zapr[i].s].s);
        }
    }
    for(int i = 1; i <= n; i ++){
        if(get(i)==i){
            dfs(i);
        }
    }
    for(int i = 1; i <= n; i++){
        Do.upd(1,1,n,in[i],{a[i],in[i]});
    }
    for(int i = 0; i < q; i++){
        if(zapr[i].f==1){
            int x=zapr[i].s;
            pii c=Do.get(in[x],out[x],1,1,n);
            Do.upd(1,1,n,c.s,{0,c.s});
            cout<<c.f<<"\n";
        }
    }
    return 0;
}
/*
(3a(b(4c)))
*/


#include <bits/stdc++.h>

using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef long long ll;
#define f first
#define s second
#define endl '\n'
#define m_p make_pair
#define all(x) x.begin(),x.end()
const int N=5e5+1;
int p[ N ],tin [ N ],tout[ N ],timer=0;
int get( int v ){
    return p[v] = ( v == p[v] ? v : get( p[ v ] ) );
}
int n,m,q;
vector<int> g [ N ];
pii t[ 4 * N ];
int a[ N ];
int obr[N];
void mg(int a, int b){
    int c = get( a ), d = get( b );
    if(c == d) return ;
    n++;
    p[c]=n;
    p[d]=n;
    g[ n ].emplace_back(c);
    g[ n ].emplace_back(d);
    return ;
}
bool us[N];
void dfs(int v, int p){
    tin[ v ] =++ timer;
    for(auto &z : g[ v ]){
        dfs( z, v );
    }
    tout[ v ] = timer;
}
pii getMax(int l,int r,int v,int tl,int tr){
    if(tl>=l && tr<=r){
        return t[v];
    }
    if(tl>r || tr<l) return {0,n};
    int tm=(tl+tr)>>1;
    return max(getMax(l,r,2*v,tl,tm),getMax(l,r,2*v+1,tm+1,tr));
}
void upd(int id,int v,int tl,int tr,pii vl){
    if(tl==tr){
        t[v]=vl;
        return ;
    }
    int tm=(tl+tr)>>1;
    if(tm>=id)
        upd(id,2*v,tl,tm,vl);
    else
        upd(id,2*v+1,tm+1,tr,vl);
    t[v]=max(t[2*v],t[2*v+1]);
}
pii e[N];
bool ex[N];
pii qe[N];
signed main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i = 0;i < m;i++){
        int v,u;
        cin>>v>>u;
        e[i]={v,u};
    }
    iota(p,p+N,0);
    for(int i = 0;i < q;i++){
        int tp;
        cin>>tp;
        int id;
        cin>>id;
        if(tp==2){
            ex[id-1]=1;
        }
        qe[i]={tp,id};
    }
    for(int i = 0; i < m;i++){
        if(!ex[i]){
            mg(e[i].f,e[i].s);
        }
    }
    for(int i = q - 1; ~ i; --i){
        if(qe[i].f==2)
            mg(e[qe[i].s-1].f,e[qe[i].s-1].s);
        else {
            qe[i].s=get(qe[i].s);
//            debug()<<imie(qe[i].s);
        }
    }
    for(int i = 1;i <= n; i++){
        if(get(i)==i)
            dfs(i,i);
//        upd(tin[i],1,1,timer,{a[i],tin[i]});
    }
    for(int i = 1;i<=n;i++){
         upd(tin[i],1,1,timer,{a[i],tin[i]});
    }
    assert(n==timer);
    for(int i = 0; i<q; i++){
        if(qe[i].f==1){
            int id=qe[i].s;
            auto w=getMax(tin[id],tout[id],1,1,timer);
            upd(w.s,1,1,timer,m_p(0,w.s));
            cout<<w.f<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef long long ll;
#define f first
#define s second
#define endl '\n'
#define all(x) x.begin(),x.end()
const int N=5e5+1;
int p[ N ],tin [ N ],tout[ N ],timer=1;
int get( int v ){
    return p[v] = ( v == p[v] ? v : get( p[ v ] ) );
}
int n,m,q;
vector<int> g [ N ];
pii t[ 4*N ];
int a[ N ];
int obr[N];
void mg(int a, int b){
    int c = get( a ), d = get( b );
    if(c == d) return;
    n++;
    p[c]=n;
    p[d]=n;
    g[ n ].emplace_back(c);
    g[ n ].emplace_back(d);
    return ;
}
void dfs(int v, int p){
    tin[ v ] = timer++;
    obr[ timer - 1] = v;
    for(auto &z : g[ v ]){
        dfs( z, v );
    }
    tout[ v ] = timer - 1;
}
void b_tr(int v,int tl,int tr){
    if(tl == tr){
        t[v]={a[obr[tl]],tl};
    }
    else{
        int tm=(tl+tr)>>1;
        b_tr(2*v,tl,tm);
        b_tr(2*v+1,tm+1,tr);
        t[v]=max(t[2*v],t[2*v+1]);
    }
}
pii getMax(int l,int r,int v,int tl,int tr){
    if(tl>=l && tr<=r){
        return t[v];
    }
    if(tl>r || tr<l) return {0,n};
    int tm=(tl+tr)>>1;
    return max(getMax(l,r,2*v,tl,tm),getMax(l,r,2*v+1,tm+1,tr));
}
void upd(int id,int v,int tl,int tr){
    if(tl==tr){
        t[v].first=0;
        return ;
    }
    int tm=(tl+tr)>>1;
    if(tm>=id)
        upd(id,2*v,tl,tm);
    else
        upd(id,2*v+1,tm+1,tr);
    t[v]=max(t[2*v],t[2*v+1]);
}
pii e[N];
bool ex[N];
pii qe[N];
signed main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);
    cin>>n>>m>>q;
    int prv=n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i = 0;i < m;i++){
        int v,u;
        cin>>v>>u;
        e[i]={v,u};
    }
    iota(p,p+N,0);
    for(int i = 0;i < q;i++){
        int tp;
        cin>>tp;
        int id;
        cin>>id;
        if(tp==2){
            ex[id-1]=1;
        }
        qe[i]={tp,id};
    }
    for(int i = 0; i < m;i++){
        if(!ex[i]){
            mg(e[i].f,e[i].s);
        }
    }
    for(int i = q - 1; ~ i; --i){
        if(qe[i].f==2)
            mg(e[qe[i].s-1].f,e[qe[i].s-1].s);
        else {
            qe[i].s=get(qe[i].s);
        }
    }
    for(int i = 1;i <= n; i++){
        if(get(i)==i)
            dfs(i,i);
    }
    b_tr(1,1,n);
    for(int i=1;i<=prv;i++){
        assert(a[i]==getMax(tin[i],tout[i],1,1,n).f);
    }
    for(int i = i=0; i<q; i++){
        if(qe[i].f==1){
            int id=qe[i].s;
            auto w=getMax(tin[id],tout[id],1,1,n);
            upd(w.s,1,1,n);
            cout<<w.f<<endl;
        }
    }
//    reverse(all(ans));
//    for(auto &z : ans) cout<<z<<endl;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld double
#define lld long double
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define endl "\n"
#define maxx 9223372036854775807
using namespace std;
ll N,M,u,v,visited[100001];
priority_queue<ll> Q;
vector<ll> V[100001], vec;
int main()
{
    cin>>N>>M;
    while(M--)
    {
        cin>>u>>v;
        V[u].push_back(v);
        V[v].push_back(u);
    }
    Q.push(1);
    while(!Q.empty())
    {
        ll x = Q.top();
        Q.pop();
        vec.push_back(x);
        for(ll i:V[x])
        {
            if(!visited[i])
            {
                Q.push(i);
                visited[i] = 1;
            }
        }
    }
    for(ll i:vec)  cout<<i<<" ";
}


#include <bits/stdc++.h>
#define ll long long
#define ld double
#define lld long double
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define endl "\n"
#define maxx 9223372036854775807
using namespace std;
ll N,M,u,v,visited[100001];
set<ll> V[100001];
vector<ll> vec;
void DFS(ll node)
{
    visited[node] = 1;
    vec.push_back(node);
    for(ll i:node)  if(!visited[i])  DFS(i);
}
int main()
{
    cin>>N>>M;
    while(M--)
    {
        cin>>u>>v;
        V[u].insert(v);
        V[v].insert(u);
    }
    for(ll i=1;i<=N;i++)  if(!visited[i])  DFS(i);
    for(ll i:vec)  cout<<i<<" ";
}


#include <bits/stdc++.h>
#define ll long long
#define ld double
#define lld long double
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define endl "\n"
#define maxx 9223372036854775807
using namespace std;
ll N,M,u,v,visited[100001];
priority_queue<ll> Q;
vector<ll> V[100001], vec;
int main()
{
    cin>>N>>M;
    while(M--)
    {
        cin>>u>>v;
        V[u].push_back(v);
        V[v].push_back(u);
    }
    Q.push(1);
    visited[i] = 1;
    while(!Q.empty())
    {
        ll x = Q.top();
        Q.pop();
        vec.push_back(x);
        for(ll i:V[x])
        {
            if(!visited[i])
            {
                Q.push(i);
                visited[i] = 1;
            }
        }
    }
    for(ll i:vec)  cout<<i<<" ";
}


#include <bits/stdc++.h>
#define ll long long
#define ld double
#define lld long double
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define endl "\n"
#define maxx 9223372036854775807
using namespace std;
ll N,M,u,v,visited[100001];
priority_queue<ll> Q;
vector<ll> V[100001], vec;
int main()
{
    cin>>N>>M;
    while(M--)
    {
        cin>>u>>v;
        V[u].push_back(v);
        V[v].push_back(u);
    }
    Q.push(1);
    visited[1] = 1;
    while(!Q.empty())
    {
        ll x = Q.top();
        Q.pop();
        vec.push_back(x);
        for(ll i:V[x])
        {
            if(!visited[i])
            {
                Q.push(i);
                visited[i] = 1;
            }
        }
    }
    for(ll i:vec)  cout<<i<<" ";
}


#include <bits/stdc++.h>
#define ll long long
#define ld double
#define lld long double
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define endl "\n"
#define maxx 9223372036854775807
using namespace std;
ll N,M,u,v,visited[100001];
priority_queue<ll, vector<ll>, greater<ll>> Q;
vector<ll> V[100001], vec;
int main()
{
    cin>>N>>M;
    while(M--)
    {
        cin>>u>>v;
        V[u].push_back(v);
        V[v].push_back(u);
    }
    Q.push(1);
    visited[1] = 1;
    while(!Q.empty())
    {
        ll x = Q.top();
        Q.pop();
        vec.push_back(x);
        for(ll i:V[x])
        {
            if(!visited[i])
            {
                Q.push(i);
                visited[i] = 1;
            }
        }
    }
    for(ll i:vec)  cout<<i<<" ";
}


#include <bits/stdc++.h>
using namespace std;
vector<int>v[100005];
int mark[100005];
priority_queue<int,vector<int>,greater<int> >pq;

void dfs(int node){
	if(mark[node]!=0){
		return;
	}
	mark[node]=1;
	cout<<node<<" ";
	for(int i=0;i<v[node].size();i++){
		if(mark[v[node][i]]==0){
			pq.push(v[node][i]);
		}
	}
	if(pq.size()>0){
		int kl=pq.top();
		pq.pop();
		if(mark[kl]==0)
			dfs(kl);
	}

}

int main(){
	int a,b;
	cin>>a>>b;
	int x,y;
	for(int i=0;i<b;i++)
	{
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	dfs(1);

}


#include <bits/stdc++.h>
using namespace std;
vector<int>v[100005];
int mark[100005];
priority_queue<int,vector<int>,greater<int> >pq;

int main(){
	int a,b;
	cin>>a>>b;
	int x,y;
	for(int i=0;i<b;i++)
	{
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	pq.push(1);
	while(pq.size()>0){

		int kl=pq.top();
		if(mark[kl]!=0){
			pq.pop();
			continue;
		}
		mark[kl]=1;
		cout<<kl<<" ";
		pq.pop();
		for(int i=0;i<v[kl].size();i++){
			if(mark[v[kl][i]]==0){
				//cout<<"a";
				pq.push(v[kl][i]);
			}
		}
	}

}


#include <bits/stdc++.h>
using namespace std;
vector<int>v[100005];
int mark[100005];
priority_queue<int,vector<int>,greater<int> >pq;

void dfs(int node){
	if(mark[node]!=0){
		return;
	}
	mark[node]=1;
	cout<<node<<" ";
	for(int i=0;i<v[node].size();i++){
		if(mark[v[node][i]]==0){
			pq.push(v[node][i]);
		}
	}
	int kl=pq.top();
	if(pq.size()>0)
		pq.pop();
	dfs(kl);
}

int main(){
	int a,b;
	cin>>a>>b;
	int x,y;
	for(int i=0;i<b;i++)
	{
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	dfs(1);

}


#include <bits/stdc++.h>

using namespace std;
int h[100005];
vector<int>v[100005];
priority_queue<int,vector<int>,greater<int> >pq;
int main(){
	int node;
	int yol;
	int a,b;
	scanf("%d %d",&node,&yol);

	for(int i = 0;i<yol;i++){
		cin>>a>>b;
		v[b].push_back(a);
		v[a].push_back(b);
	}
	pq.push(1);

	int k;
	while(pq.empty()==false){
		k=pq.top();
		pq.pop();
		if(h[k]==1){
			continue;

		}
		h[k]=1;

		cout<<k<<" ";

		for(int i = 0;i<v[k].size();i++){
			if(h[v[k][i]]==0){
				pq.push(v[k][i]);
			}
		}
	}
}


#include <bits/stdc++.h>
using namespace std;
vector<int>v[100005];
int mark[100005];
priority_queue<int,vector<int>,greater<int> >pq;

void dfs(int node){
	if(mark[node]!=0){
		return;
	}
	mark[node]=1;
	cout<<node<<" ";
	for(int i=0;i<v[node].size();i++){
		if(mark[v[node][i]]==0){
			pq.push(v[node][i]);
		}
	}
	if(pq.size()>0){
		int kl=pq.top();
		pq.pop();
		dfs(kl);
	}
	else{
		return;
	}
}

int main(){
	int a,b;
	cin>>a>>b;
	int x,y;
	for(int i=0;i<b;i++)
	{
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	dfs(1);

}


#include <bits/stdc++.h>
using namespace std;
vector<int>v[100005];
int mark[100005];
priority_queue<int,vector<int>,greater<int> >pq;

void dfs(int node){
	if(mark[node]!=0){
		return;
	}
	mark[node]=1;
	cout<<node<<" ";
	for(int i=0;i<v[node].size();i++){
		pq.push(v[node][i]);
	}
	if(pq.size()>0){
		int kl=pq.top();
		pq.pop();
		dfs(kl);
	}
	else{
		return;
	}
}

int main(){
	int a,b;
	cin>>a>>b;
	int x,y;
	for(int i=0;i<b;i++)
	{
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	dfs(1);

}


#include <bits/stdc++.h>
using namespace std;
vector<int>v[100005];
int mark[100005];
priority_queue<int,vector<int>,greater<int> >pq;

void dfs(int node){
	if(mark[node]!=0){
		return;
	}
	mark[node]=1;
	cout<<node<<" ";
	for(int i=0;i<v[node].size();i++){
		if(mark[v[node][i]]==0){
			pq.push(v[node][i]);
		}
	}
	if(pq.size()>0){
		int kl=pq.top();
		pq.pop();
		while(mark[kl]!=0 && pq.size()>0){
			pq.pop();
			kl=pq.top();
		}
		dfs(kl);
	}

}

int main(){
	int a,b;
	cin>>a>>b;
	int x,y;
	for(int i=0;i<b;i++)
	{
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	dfs(1);

}


#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define gcd(a, b)   __gcd(a, b)
#define hey         cout<<"here";
#define lcm(a, b)   ((a)*1ll * (b)) / gcd(a, b)
#define pb              push_back
#define mp              make_pair
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define nl             "\n"
#define w(x)            int x; cin>>x; while(x--)
#define fre(i,a,n)      for (int i = a; i <= n; ++i)
#define fr(i,n)         for (int i = 0; i < n; ++i)
#define rf(i,a,n)       for (int i = n; i >=a; --i)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int pow(int a, int b, int m)
{
    int ans = 1;
    while (b)
    {
        if (b & 1)
            ans = (ans * a) % m;
        b /= 2;
        a = (a * a) % m;
    }
    return ans;
}

const int N = 100005;

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int n, m;

vector<int>g[N];
map<int,bool>vis;
void dfs(int src){
        vis[src]=true;
        cout<<src+1<<" ";
        for(auto child: g[src]){
                if(!vis[child]) {dfs(child);}
        }
        return;
}

void solve()
{

    cin >> n >> m;
    fr(i, n) {
        int x, y;
        cin >> x >> y;
        x--;y--;
        g[x].pb(y);
        g[y].pb(x);
    }
    fr(i, n) {
        sort(g[i].begin(), g[i].end());
    }
    dfs(0);

}

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int32_t main()
{
    FIO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    solve();
    // w(x)    {solve();}
#ifndef ONLINE_JUDGE
    cerr << "\nTime Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
}


#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define gcd(a, b)   __gcd(a, b)
#define hey         cout<<"here";
#define lcm(a, b)   ((a)*1ll * (b)) / gcd(a, b)
#define pb              push_back
#define mp              make_pair
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define nl             "\n"
#define w(x)            int x; cin>>x; while(x--)
#define fre(i,a,n)      for (int i = a; i <= n; ++i)
#define fr(i,n)         for (int i = 0; i < n; ++i)
#define rf(i,a,n)       for (int i = n; i >=a; --i)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int pow(int a, int b, int m)
{
    int ans = 1;
    while (b)
    {
        if (b & 1)
            ans = (ans * a) % m;
        b /= 2;
        a = (a * a) % m;
    }
    return ans;
}

const int N = 100005;

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int n, m;

vector<int>g[N];
map<int,bool>vis;
void dfs(int src){
        vis[src]=true;
        cout<<src+1<<" ";
        for(auto child: g[src]){
                if(!vis[child]) {dfs(child);}
        }
        return;
}

void solve()
{

    cin >> n >> m;
    fr(i, m) {
        int x, y;
        cin >> x >> y;
        x--;y--;
        g[x].pb(y);
        g[y].pb(x);
    }
    fr(i, n) {
        sort(g[i].begin(), g[i].end());
    }

    dfs(0);

}

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int32_t main()
{
    FIO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    solve();
    // w(x)    {solve();}
#ifndef ONLINE_JUDGE
    cerr << "\nTime Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
}


#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define gcd(a, b)   __gcd(a, b)
#define hey         cout<<"here";
#define lcm(a, b)   ((a)*1ll * (b)) / gcd(a, b)
#define pb              push_back
#define mp              make_pair
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define nl             "\n"
#define w(x)            int x; cin>>x; while(x--)
#define fre(i,a,n)      for (int i = a; i <= n; ++i)
#define fr(i,n)         for (int i = 0; i < n; ++i)
#define rf(i,a,n)       for (int i = n; i >=a; --i)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int pow(int a, int b, int m)
{
    int ans = 1;
    while (b)
    {
        if (b & 1)
            ans = (ans * a) % m;
        b /= 2;
        a = (a * a) % m;
    }
    return ans;
}

const int N = 100005;

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int n, m;

vector<int>g[N];
map<int,bool>vis;
void dfs(int src){
        vis[src]=true;
        cout<<src<<" ";
        for(auto child: g[src]){
                if(!vis[child]) {dfs(child);}
        }
        return;
}

void solve()
{

    cin >> n >> m;
    fr(i, n) {
        int x, y;
        cin >> x >> y;
        g[x].pb(y);
        g[y].pb(x);
    }
    fre(i,1, n) {
        sort(g[i].begin(), g[i].end());
    }
    dfs(1);

}

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int32_t main()
{
    FIO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    solve();
    // w(x)    {solve();}
#ifndef ONLINE_JUDGE
    cerr << "\nTime Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
}


#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define gcd(a, b)   __gcd(a, b)
#define hey         cout<<"here";
#define lcm(a, b)   ((a)*1ll * (b)) / gcd(a, b)
#define pb              push_back
#define mp              make_pair
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define nl             "\n"
#define w(x)            int x; cin>>x; while(x--)
#define fre(i,a,n)      for (int i = a; i <= n; ++i)
#define fr(i,n)         for (int i = 0; i < n; ++i)
#define rf(i,a,n)       for (int i = n; i >=a; --i)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int pow(int a, int b, int m)
{
    int ans = 1;
    while (b)
    {
        if (b & 1)
            ans = (ans * a) % m;
        b /= 2;
        a = (a * a) % m;
    }
    return ans;
}

const int N = 100005;

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int n, m;

vector<int>g[N];
map<int,bool>vis;

void solve()
{

    cin >> n >> m;
    fr(i, m) {
        int x, y;
        cin >> x >> y;

        g[x].pb(y);
        g[y].pb(x);
    }
    set<int>can;
    vector<int>ans;
    ans.pb(1);
    vis[1]=true;
    while(ans.size()<n){
        int i=ans.back();
        for(auto it : g[i]){
                if(!vis[it]){
                        can.insert(it);
                }
        }
        auto it=can.begin();
        ans.pb(*it);
        vis[*it]=true;
        can.erase(*it);

    }
    for(auto x: ans) cout<<x<<" ";

}

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int32_t main()
{
    FIO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    solve();
    // w(x)    {solve();}
#ifndef ONLINE_JUDGE
    cerr << "\nTime Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
}


#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define gcd(a, b)   __gcd(a, b)
#define hey         cout<<"here";
#define lcm(a, b)   ((a)*1ll * (b)) / gcd(a, b)
#define pb              push_back
#define mp              make_pair
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define nl             "\n"
#define w(x)            int x; cin>>x; while(x--)
#define fre(i,a,n)      for (int i = a; i <= n; ++i)
#define fr(i,n)         for (int i = 0; i < n; ++i)
#define rf(i,a,n)       for (int i = n; i >=a; --i)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int pow(int a, int b, int m)
{
    int ans = 1;
    while (b)
    {
        if (b & 1)
            ans = (ans * a) % m;
        b /= 2;
        a = (a * a) % m;
    }
    return ans;
}

const int N = 100005;

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int n, m;

vector<int>g[N];
map<int,bool>vis;
void dfs(int src){
        vis[src]=true;
        cout<<src+1<<" ";
        for(auto child: g[src]){
                if(!vis[child]) {dfs(child);}
        }
        return;
}

void solve()
{

    cin >> n >> m;
    fr(i, n) {
        int x, y;
        cin >> x >> y;
        g[--x].pb(--y);
        g[y].pb(x);
    }
    fr(i, n) {
        sort(g[i].begin(), g[i].end());
    }
    cout<<nl;
    dfs(0);

}

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int32_t main()
{
    FIO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    solve();
    // w(x)    {solve();}
#ifndef ONLINE_JUDGE
    cerr << "\nTime Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
}


#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define gcd(a, b)   __gcd(a, b)
#define hey         cout<<"here";
#define lcm(a, b)   ((a)*1ll * (b)) / gcd(a, b)
#define pb              push_back
#define mp              make_pair
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define nl             "\n"
#define w(x)            int x; cin>>x; while(x--)
#define fre(i,a,n)      for (int i = a; i <= n; ++i)
#define fr(i,n)         for (int i = 0; i < n; ++i)
#define rf(i,a,n)       for (int i = n; i >=a; --i)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int pow(int a, int b, int m)
{
    int ans = 1;
    while (b)
    {
        if (b & 1)
            ans = (ans * a) % m;
        b /= 2;
        a = (a * a) % m;
    }
    return ans;
}

const int N = 100005;

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int n, m;

vector<int>g[N];
map<int,bool>vis;
void dfs(int src){
        vis[src]=true;
        cout<<src<<" ";
        for(auto child: g[src]){
                if(!vis[child]) {dfs(child);}
        }
        return;
}

void solve()
{

    cin >> n >> m;
    fr(i, m) {
        int x, y;
        cin >> x >> y;
        g[x].pb(y);
        g[y].pb(x);
    }
    fre(i,1, n) {
        sort(g[i].begin(), g[i].end());
    }
    dfs(1);

}

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

int32_t main()
{
    FIO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    solve();
    // w(x)    {solve();}
#ifndef ONLINE_JUDGE
    cerr << "\nTime Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
}


#include <bits/stdc++.h>

using namespace std;

#define N 100005

int n, m, id, output[N];
vector<int> vertex[N];
set<int> sad;
bool flag[N];

void printSet();
void readInput();

int main()
{
  readInput();
  output[0] = 1;
  flag[1] = true;
  for (auto y : vertex[1])
  {
    if (!flag[y])
    {
      sad.insert(y);
    }
  }
  id = 0;
  while (id < n)
  {
    int temp = *sad.begin();
    sad.erase(temp);
    output[++id] = temp;
    flag[temp] = true;
    for (auto y : vertex[temp])
      if (!flag[y])
        sad.insert(y);
  }
  for (int i = 0; i < n; ++i)
  {
    cout << output[i];
    if (i != n - 1)
      cout << " ";
  }
  return 0;
}

void printSet()
{
  cout << "___";
  for (auto s : sad)
  {
    cout << s << " ";
  }
  cout << "___" << endl;
}

void readInput()
{
  cin >> n >> m;
  int u, v;
  for (int i = 0; i < m; ++i)
  {
    cin >> u >> v;
    vertex[u].push_back(v);
    vertex[v].push_back(u);

  }
}


#include <bits/stdc++.h>

using namespace std;

#define N 100000

int n, m, id, output[N];
vector<int> vertex[N];
set<int> sad;
bool flag[N];

void printSet();
void readInput();

int main()
{
  readInput();
  output[0] = 1;
  flag[1] = true;
  for (auto y : vertex[1])
  {
    if (!flag[y])
    {
      sad.insert(y);
    }
  }
  id = 0;
  while (id < n)
  {
    int temp = *sad.begin();
    sad.erase(temp);
    output[++id] = temp;
    flag[temp] = true;
    for (auto y : vertex[temp])
      if (!flag[y])
        sad.insert(y);
  }
  for (int i = 0; i < n; ++i)
  {
    cout << output[i];
    if (i != n - 1)
      cout << " ";
  }
  return 0;
}

void printSet()
{
  cout << "___";
  for (auto s : sad)
  {
    cout << s << " ";
  }
  cout << "___" << endl;
}

void readInput()
{
  cin >> n >> m;
  int u, v;
  for (int i = 0; i < m; ++i)
  {
    cin >> u >> v;
    vertex[u].push_back(v);
    vertex[v].push_back(u);

  }
}


#include <bits/stdc++.h>
using namespace std;

class Graph
{
  int V;
  list<int> *adj;
  void DFSUtil(int v, bool visited[]);

public:
  Graph(int V);
  void addEdge(int v, int w);
  void DFS(int v);
};

Graph::Graph(int V)
{
  this->V = V;
  adj = new list<int>[V];
}

void Graph::addEdge(int v, int w)
{
  adj[v].push_back(w);
}

void Graph::DFSUtil(int v, bool visited[])
{
  visited[v] = true;
  cout << v << " ";
  adj[v].sort();
  for (auto i : adj[v])
  {
    if (!visited[i])
      DFSUtil(i, visited);
  }
}
void Graph::DFS(int v)
{
  bool *visited = new bool[V];
  for (int i = 0; i < V; i++)
    visited[i] = false;
  DFSUtil(v, visited);
}

main()
{
  int n, m, u1, v1, u, v;
  cin >> n >> m;
  Graph g(n + 1);
  cin >> u1 >> v1;
  g.addEdge(u1, v1);
  g.addEdge(v1, u1);
  for (int i = 2; i <= m; i++)
  {
    cin >> u >> v;
    g.addEdge(u, v);
    g.addEdge(v, u);
  }
  g.DFS(1);
}


#include <bits/stdc++.h>
using namespace std;

class Graph
{
  int V;
  list<int> *adj;
  void DFSUtil(int v, bool visited[]);

public:
  Graph(int V);
  void addEdge(int v, int w);
  void DFS(int v);
};

Graph::Graph(int V)
{
  this->V = V;
  adj = new list<int>[V];
}

void Graph::addEdge(int v, int w)
{
  adj[v].push_back(w);
}

void Graph::DFSUtil(int v, bool visited[])
{
  visited[v] = true;
  cout << v << " ";
  list<int>::iterator i;
  adj[v].sort();
  for (i = adj[v].begin(); i != adj[v].end(); ++i)
  {
    if (!visited[*i])
      DFSUtil(*i, visited);
  }
}
void Graph::DFS(int v)
{
  bool *visited = new bool[V];
  for (int i = 0; i < V; i++)
    visited[i] = false;
  DFSUtil(v, visited);
}

main()
{
  int n, m, u1, v1, u, v;
  cin >> n >> m;
  Graph g(n + 1);
  cin >> u1 >> v1;
  g.addEdge(u1, v1);
  g.addEdge(v1, u1);
  for (int i = 2; i <= m; i++)
  {
    cin >> u >> v;
    g.addEdge(u, v);
    g.addEdge(v, u);
  }
  g.DFS(u1);
}