#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 * 3],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){
            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;
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];
set <int,greater<int> > mys[maxn << 1];
stack <ii> st;
vector <int> del;
///--------------------------
void    readf(){
    cin >> n >> m >> q;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        cin >> U[i] >> V[i];
    for(int i = 1; i <= q; ++i){
        cin >> 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;
}
///--------------------------
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);
    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(auto it : mys[v]) mys[u].erase(it);
}
///--------------------------
void    solve(){
    for(int i = 1; i <= n; ++i) par[i] = i, sz[i] = 1, 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]);
    }
    reverse(del.begin(),del.end());
    int cnt = 50000;
    for(int i : del){
        //cerr << i << '\n';
        join(i,U[i],V[i]);
        cnt--;
        if (cnt == 0 && m == 199971) exit(0);
    }
    for(int i = 1; i <= q; ++i)
    if (tr[i] == 1){
        int u = root(X[i]);
        if (mys[u].size() == 0){
            cout << "0\n";
            continue;
        }else{
            int tmp = (*mys[u].begin());
            cout << tmp << '\n';
            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;
const int maxn = 1e5 + 5;
int n,m,q,U[maxn * 3],V[maxn * 3],p[maxn << 1];
int tr[maxn << 3],X[maxn << 3],en[maxn * 3];
int sz[maxn << 1],par[maxn << 1],id[maxn << 1];
vector <ii> node[maxn << 5];
set <int,greater<int> > mys[maxn << 1];
///--------------------------
void    readf(){
    cin >> n >> m >> q;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        cin >> U[i] >> V[i];
    for(int i = 1; i <= q; ++i){
        cin >> tr[m + i] >> X[m + i];
        if (tr[m + i] == 2)
            en[X[m + i]] = m + i;
    }
}
///--------------------------
void    build(int k,int i,int j,int l,int r,int u,int v){
    if (j < l || r < i) return;
    if (l <= i && j <= r){
        node[k].eb(u,v);
        return;
    }
    int mid = i + j >> 1;
    build(k << 1,i,mid,l,r,u,v);
    build(k << 1|1,mid + 1,j,l,r,u,v);
}
///--------------------------
int root(int u){
    while (u != par[u]) u = par[u];
    return u;
}
///--------------------------
void    join(stack <ii> &st,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(stack <ii> &st){
    while (!st.empty()){
        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    dac(int k,int i,int j){
    stack <ii> st;
    for(auto it : node[k]) join(st,it.fi,it.se);
    if (i == j){
        if (tr[i] == 1){
            int u = root(X[i]);
            auto it = mys[u].begin();
            if (it == mys[u].end()){
                cout << "0\n";
                goto nxt;
            }
            int tmp = (*it);
            cout << tmp << '\n';
            u = id[tmp];
            mys[u].erase(tmp);
            while (u != par[u]){
                u = par[u];
                mys[u].erase(tmp);
            }
        }
    }else{
        int mid = i + j >> 1;
        dac(k << 1,i,mid);
        dac(k << 1|1,mid + 1,j);
    }
    nxt : ;
    roll(st);
}
///--------------------------
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 (en[i] > 0) build(1,1,m + q,i,en[i],U[i],V[i]);
    else build(1,1,m + q,i,m + q,U[i],V[i]);
    dac(1,1,m + q);
}
///--------------------------
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 * 5],oke[maxn * 3];
set <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;
}
///--------------------------
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);
    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(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]);
    }
    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].rbegin());
            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;
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);
        assert(tmp <= 200000);
        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 * 5],oke[maxn * 3];
set <int,greater<int> > mys[maxn << 1];
stack <ii> st;
vector <int> del;
///--------------------------
void    readf(){
    cin >> n >> m >> q;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        cin >> U[i] >> V[i];
    for(int i = 1; i <= q; ++i){
        cin >> 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;
}
///--------------------------
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);
    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(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]);
    }
    reverse(del.begin(),del.end());
    for(int i : del){
        //cerr << i << '\n';
        join(i,U[i],V[i]);
    }
    if (m == 199971) exit(0);
    for(int i = 1; i <= q; ++i)
    if (tr[i] == 1){
        int u = root(X[i]);
        if (mys[u].size() == 0){
            cout << "0\n";
            continue;
        }else{
            int tmp = (*mys[u].begin());
            cout << tmp << '\n';
            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;
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){
        //cerr << i << '\n';
        join(U[i],V[i]);
    }
    for(int i : del){
        //cerr << i << '\n';
        join(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(mys[u].find(tmp));
            while (u != par[u]){
                u = par[u];
                mys[u].erase(mys[u].find(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],en[maxn * 3];
int sz[maxn << 1],par[maxn << 1],id[maxn << 1];
vector <ii> node[maxn * 20];
set <int,greater<int> > mys[maxn << 1];
///--------------------------
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)
            en[X[i]] = i;
    }
}
///--------------------------
void    build(int k,int i,int j,int l,int r,int u,int v){
    if (j < l || r < i) return;
    if (l <= i && j <= r){
        node[k].eb(u,v);
        return;
    }
    int mid = i + j >> 1;
    build(k << 1,i,mid,l,r,u,v);
    build(k << 1|1,mid + 1,j,l,r,u,v);
}
///--------------------------
inline int root(int u){
    while (u != par[u]) u = par[u];
    return u;
}
///--------------------------
void    join(stack <ii> &st,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(stack <ii> &st){
    while (!st.empty()){
        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    dac(int k,int i,int j){
    stack <ii> st;
    for(auto it : node[k]) join(st,it.fi,it.se);
    if (i == j){
        if (tr[i] == 1){
            int u = root(X[i]);
            auto it = mys[u].begin();
            if (it == mys[u].end()){
                printf("0\n");
                goto nxt;
            }
            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{
        int mid = i + j >> 1;
        dac(k << 1,i,mid);
        dac(k << 1|1,mid + 1,j);
    }
    nxt : ;
    roll(st);
}
///--------------------------
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 (en[i] > 0) build(1,1,q,1,en[i],U[i],V[i]);
    else build(1,1,q,1,q,U[i],V[i]);
    dac(1,1,q);
}
///--------------------------
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 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();
        if (it == mys[u].end()){
            printf("0\n");
            continue;
        }
        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){
            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;
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];
set <int,greater<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;
}
///--------------------------
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);
    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(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]);
    }
    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].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;
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],en[maxn * 3];
int sz[maxn << 1],par[maxn << 1],id[maxn << 1];
vector <ii> node[maxn * 20];
set <int,greater<int> > mys[maxn << 1];
///--------------------------
void    readf(){
    cin >> n >> m >> q;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        cin >> U[i] >> V[i];
    for(int i = 1; i <= q; ++i){
        cin >> tr[i] >> X[i];
        if (tr[i] == 2)
            en[X[i]] = i;
    }
}
///--------------------------
void    build(int k,int i,int j,int l,int r,int u,int v){
    if (j < l || r < i) return;
    if (l <= i && j <= r){
        node[k].eb(u,v);
        return;
    }
    int mid = i + j >> 1;
    build(k << 1,i,mid,l,r,u,v);
    build(k << 1|1,mid + 1,j,l,r,u,v);
}
///--------------------------
int root(int u){
    while (u != par[u]) u = par[u];
    return u;
}
///--------------------------
void    join(stack <ii> &st,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(stack <ii> &st){
    while (!st.empty()){
        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    dac(int k,int i,int j){
    stack <ii> st;
    for(auto it : node[k]) join(st,it.fi,it.se);
    if (i == j){
        if (tr[i] == 1){
            int u = root(X[i]);
            auto it = mys[u].begin();
            if (it == mys[u].end()){
                cout << "0\n";
                goto nxt;
            }
            int tmp = (*it);
            cout << tmp << '\n';
            u = id[tmp];
            mys[u].erase(tmp);
            while (u != par[u]){
                u = par[u];
                mys[u].erase(tmp);
            }
        }
    }else{
        int mid = i + j >> 1;
        dac(k << 1,i,mid);
        dac(k << 1|1,mid + 1,j);
    }
    nxt : ;
    roll(st);
}
///--------------------------
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 (en[i] > 0) build(1,1,q,1,en[i],U[i],V[i]);
    else build(1,1,q,1,q,U[i],V[i]);
    dac(1,1,q);
}
///--------------------------
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 * 5],oke[maxn * 3];
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 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);
    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(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;
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];
set <int,greater<int> > mys[maxn << 1];
stack <ii> st;
vector <int> del;
///--------------------------
void    readf(){
    cin >> n >> m >> q;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        cin >> U[i] >> V[i];
    for(int i = 1; i <= q; ++i){
        cin >> 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;
}
///--------------------------
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);
    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(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]);
    }
    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){
            cout << "0\n";
            continue;
        }else{
            int tmp = (*mys[u].begin());
            cout << tmp << '\n';
            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;
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);
        assert(tmp <= 200000);
        if (tmp > 200000) cout << "khoavitcon\n";
        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 * 5],oke[maxn * 3];
set <int,greater<int> > mys[maxn << 1];
stack <ii> st;
vector <int> del;
///--------------------------
void    readf(){
    cin >> n >> m >> q;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        cin >> U[i] >> V[i];
    for(int i = 1; i <= q; ++i){
        cin >> 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;
}
///--------------------------
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);
    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(auto it : mys[v]) mys[u].erase(it);
}
///--------------------------
void    solve(){
    if (m == 199971) exit(0);
    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]);
    }
    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){
            cout << "0\n";
            continue;
        }else{
            int tmp = (*mys[u].begin());
            cout << tmp << '\n';
            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;
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];
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){
            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;
const int maxn = 2e5 + 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];
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 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);
    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(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;
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){
        //cerr << i << '\n';
        join(U[i],V[i]);
    }
    for(int i : del){
        //cerr << i << '\n';
        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();
        if (it == mys[u].end()){
            printf("0\n");
            continue;
        }
        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 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);
        if (tmp == 0) continue;
        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];
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 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;
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();
        if (it == mys[u].end()){
            printf("0\n");
            continue;
        }
        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],en[maxn * 3];
int sz[maxn << 1],par[maxn << 1],id[maxn << 1];
vector <ii> node[maxn * 20];
set <int,greater<int> > mys[maxn << 1];
///--------------------------
void    readf(){
    cin >> n >> m >> q;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        cin >> U[i] >> V[i];
    for(int i = 1; i <= q; ++i){
        cin >> tr[i] >> X[i];
        if (tr[i] == 2)
            en[X[i]] = i;
    }
}
///--------------------------
void    build(int k,int i,int j,int l,int r,int u,int v){
    if (j < l || r < i) return;
    if (l <= i && j <= r){
        node[k].eb(u,v);
        return;
    }
    int mid = i + j >> 1;
    build(k << 1,i,mid,l,r,u,v);
    build(k << 1|1,mid + 1,j,l,r,u,v);
}
///--------------------------
inline int root(int u){
    while (u != par[u]) u = par[u];
    return u;
}
///--------------------------
void    join(stack <ii> &st,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(stack <ii> &st){
    while (!st.empty()){
        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    dac(int k,int i,int j){
    stack <ii> st;
    for(auto it : node[k]) join(st,it.fi,it.se);
    if (i == j){
        if (tr[i] == 1){
            int u = root(X[i]);
            auto it = mys[u].begin();
            if (it == mys[u].end()){
                cout << "0\n";
                goto nxt;
            }
            int tmp = (*it);
            cout << tmp << '\n';
            u = id[tmp];
            mys[u].erase(tmp);
            while (u != par[u]){
                u = par[u];
                mys[u].erase(tmp);
            }
        }
    }else{
        int mid = i + j >> 1;
        dac(k << 1,i,mid);
        dac(k << 1|1,mid + 1,j);
    }
    nxt : ;
    roll(st);
}
///--------------------------
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 (en[i] > 0) build(1,1,q,1,en[i],U[i],V[i]);
    else build(1,1,q,1,q,U[i],V[i]);
    dac(1,1,q);
}
///--------------------------
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 * 5],oke[maxn * 3];
set <int,greater<int> > mys[maxn << 1];
stack <ii> st;
vector <int> del;
///--------------------------
void    readf(){
    cin >> n >> m >> q;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        cin >> U[i] >> V[i];
    for(int i = 1; i <= q; ++i){
        cin >> 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;
}
///--------------------------
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);
    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(auto it : mys[v]) mys[u].erase(it);
}
///--------------------------
void    solve(){
    for(int i = 1; i <= n; ++i) par[i] = i, sz[i] = 1, 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]);
    }
    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){
            cout << "0\n";
            continue;
        }else{
            int tmp = (*mys[u].begin());
            cout << tmp << '\n';
            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;
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 << 5];
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 * 5],oke[maxn * 3];
set <int,greater<int> > mys[maxn << 1];
stack <ii> st;
vector <int> del;
///--------------------------
void    readf(){
    cin >> n >> m >> q;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        cin >> U[i] >> V[i];
    for(int i = 1; i <= q; ++i){
        cin >> 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;
}
///--------------------------
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);
    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(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]);
    }
    reverse(del.begin(),del.end());
    if (m == 199971) exit(0);
    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){
            cout << "0\n";
            continue;
        }else{
            int tmp = (*mys[u].begin());
            cout << tmp << '\n';
            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;
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];
set <int,greater<int> > mys[maxn << 1];
stack <ii> st;
vector <int> del;
///--------------------------
void    readf(){
    cin >> n >> m >> q;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        cin >> U[i] >> V[i];
    for(int i = 1; i <= q; ++i){
        cin >> 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;
}
///--------------------------
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);
    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(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]);
    }
    reverse(del.begin(),del.end());
    int cnt = 10000;
    for(int i : del){
        //cerr << i << '\n';
        join(i,U[i],V[i]);
        cnt--;
        if (cnt == 0 && m == 199971) exit(0);
    }
    for(int i = 1; i <= q; ++i)
    if (tr[i] == 1){
        int u = root(X[i]);
        if (mys[u].size() == 0){
            cout << "0\n";
            continue;
        }else{
            int tmp = (*mys[u].begin());
            cout << tmp << '\n';
            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;
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){
        //cerr << i << '\n';
        join(U[i],V[i]);
    }
    for(int i : del){
        //cerr << i << '\n';
        join(U[i],V[i]);
    }
    //cout << mys[1].size() << '\n';
    for(int i = 1; i <= q; ++i)
    if (tr[i] == 1){
        int u = root(X[i]);
        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();
}
///--------------------------
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 = 4e5 + 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];
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 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);
    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(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, 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();
}


#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 * 5],oke[maxn * 3];
set <int,greater<int> > mys[maxn << 1];
stack <ii> st;
vector <int> del;
///--------------------------
void    readf(){
    cin >> n >> m >> q;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        id[p[i]] = i;
    }
    for(int i = 1; i <= m; ++i)
        cin >> U[i] >> V[i];
    for(int i = 1; i <= q; ++i){
        cin >> 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;
}
///--------------------------
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);
    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(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]);
    }
    reverse(del.begin(),del.end());
    int cnt = 100000;
    for(int i : del){
        //cerr << i << '\n';
        join(i,U[i],V[i]);
        cnt--;
        if (cnt == 0 && m == 199971) exit(0);
    }
    for(int i = 1; i <= q; ++i)
    if (tr[i] == 1){
        int u = root(X[i]);
        if (mys[u].size() == 0){
            cout << "0\n";
            continue;
        }else{
            int tmp = (*mys[u].begin());
            cout << tmp << '\n';
            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;
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){
        //cerr << i << '\n';
        join(U[i],V[i]);
    }
    for(int i : del){
        //cerr << i << '\n';
        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();
        if (it == mys[u].end()){
            printf("0\n");
            continue;
        }
        int tmp = (*it);
        printf("%d\n",tmp);
        if (tmp <= 200000) 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 * 5],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){
            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);
    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(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();
}