#include <bits/stdc++.h>   using namespace std;   void enable_comma() {}   string tostring(char c);   string tostring(long long x);   template <class A, class B>   string tostring(pair<A, B> p);   template <class A>   string tostring(vector<A> v);   string tostring(char c) {     string s =   ;     s += c;     return s;   }   string tostring(string s) { return     + s +    ; }   string tostring(char *c) { return tostring((string)c); }   string tostring(long long x) {     if (x < 0) return  -  + tostring(-x);     if (x > 9)       return tostring(x / 10) + tostring(char( 0  + x % 10));     else       return tostring(char( 0  + x));   }   string tostring(int x) { return tostring((long long)x); }   string tostring(unsigned long long x) {     if (x > 9)       return tostring((long long)(x / 10)) + tostring(char( 0  + x % 10));     else       return tostring(char( 0  + x));   }   string tostring(unsigned x) { return tostring((long long)x); }   string tostring(double x) {     static char res[114];     sprintf(res,  %lf , x);     return tostring(res);   }   string tostring(long double x) { return tostring((double)x); }   template <class A, class B>   string tostring(pair<A, B> p) {     return  (  + tostring(p.first) +  ,  + tostring(p.second) +  ) ;   }   template <class A>   string tostring(vector<A> v) {     string res =  { ;     for (int i = (0); i <= ((int)v.size() - 1); i++) {       res += tostring(v[i]);       res += i == (int)v.size() - 1 ?  }  :  , ;     }     if (res ==  { ) res +=  } ;     return res;   }   template <class A>   string tostring(A a, int L, int R) {     string res =  { ;     for (int i = (L); i <= (R); i++) {       res += tostring(a[i]);       res += i == R ?  }  :  , ;     }     if (res ==  { ) res +=  } ;     return res;   }   string tostrings() { return   ; }   template <typename Head, typename... Tail>   string tostrings(Head H, Tail... T) {     return tostring(H) +     + tostrings(T...);   }   long long read() {     long long x = 0, f = 0;     char ch = getchar();     while (!isdigit(ch)) f = ch ==  - , ch = getchar();     while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();     return f ? -x : x;   }   template <class T>   void ckmax(T &x, const T y) {     if (x < y) x = y;   }   template <class T>   void ckmin(T &x, const T y) {     if (x > y) x = y;   }   const int N = 500005 * 2;   int n, m, q;   int p[N];   pair<int, int> e[N], t[N];   int ti[N];   namespace S {   int fa[N];   void init() { iota(fa, fa + N, 0); }   int getf(int x) { return fa[x] == x ? x : fa[x] = getf(fa[x]); }   }  // namespace S   int cnt;   int fa[N], val[N];   vector<int> son[N];   int vis[N];   int I[N], O[N], ii[N];   int anc[N][20], dep[N];   int Time = 0;   void dfs(int x, int d = 1) {     vis[x] = 1;     anc[x][0] = fa[x];     for (int i = (1); i <= (19); i++) anc[x][i] = anc[anc[x][i - 1]][i - 1];     dep[x] = d;     I[x] = ++Time;     ii[Time] = x;     for (auto y : son[x]) dfs(y, d + 1);     O[x] = Time;   }   int pmax(int x, int y) { return p[x] > p[y] ? x : y; }   namespace seg {   const int S = N * 4;   int mx[S];   void pushup(int rt) {     int ls = rt << 1, rs = ls | 1;     mx[rt] = pmax(mx[ls], mx[rs]);   }   void build(int rt, int L, int R) {     if (L == R) {       mx[rt] = ii[L];       return;     }     int mid = (L + R) >> 1, ls = rt << 1, rs = ls | 1;     build(ls, L, mid);     build(rs, mid + 1, R);     pushup(rt);   }   int query(int rt, int L, int R, int xL, int xR) {     if (R < xL || L > xR) return 0;     if (xL <= L && R <= xR) return mx[rt];     int mid = (L + R) >> 1, ls = rt << 1, rs = ls | 1;     return pmax(query(ls, L, mid, xL, xR), query(rs, mid + 1, R, xL, xR));   }   void update(int rt, int L, int R, int x) {     if (L == R) {       mx[rt] = 0;       return;     }     int mid = (L + R) >> 1, ls = rt << 1, rs = ls | 1;     if (x <= mid)       update(ls, L, mid, x);     else       update(rs, mid + 1, R, x);     pushup(rt);   }   }  // namespace seg   void solve() {     n = read(), m = read(), q = read();     for (int i = (1); i <= (n); i++) p[i] = read();     for (int i = (1); i <= (m); i++) {       int x = read(), y = read();       e[i] = make_pair(x, y);       ti[i] = q + 1;     }     for (int i = (1); i <= (q); i++) {       int tp = read(), x = read();       t[i] = make_pair(tp, x);       if (tp == 2) ti[x] = i;     }     vector<int> id(m);     iota(id.begin(), id.end(), 1);     sort(id.begin(), id.end(), [&](int x, int y) { return ti[x] > ti[y]; });     cnt = n;     S::init();     for (auto i : id) {       int x = e[i].first, y = e[i].second;       int fx = S::getf(x), fy = S::getf(y);       if (fx != fy) {         int f = ++cnt;         fa[fx] = fa[fy] = S::fa[fx] = S::fa[fy] = f;         val[f] = ti[i];         son[f] = {fx, fy};         enable_comma();       }     }     for (int i = (cnt); i >= (1); i--)       if (!vis[i]) dfs(i);     seg::build(1, 1, cnt);     for (int i = (1); i <= (q); i++) {       int tp = t[i].first, x = t[i].second;       if (tp == 1) {         for (int j = (19); j >= (0); j--)           if (val[anc[x][j]] > i) x = anc[x][j];         int res = seg::query(1, 1, cnt, I[x], O[x]);         printf( %d n , p[res]);         p[res] = 0;         seg::update(1, 1, cnt, I[res]);       } else {       }     }   }   int main() {     int T = 1;     while (T--) solve();     return 0;   }   