#include <bits/stdc++.h>   using namespace std;   const int maxn = 200005;   const int maxm = 300005;   const int maxq = 500005;   const int inf = 0x3f3f3f3f;   int n, m, Q, a[maxn], fa[maxn], x_[maxm], y_[maxm], u_[maxq], v_[maxq];   bool vis[maxm];   set<int> s[maxn];   set<int>::iterator it, itl, itr;   struct oper {     int op, u;   } q[maxq];   inline int find(int x) {     while (x != fa[x]) x = fa[x];     return x;   }   inline void merge(int i, int x, int y) {     int u = find(x), v = find(y);     if (u == v) return;     if (s[u].size() > s[v].size()) swap(u, v);     u_[i] = u, v_[i] = v, fa[u] = v;     for (auto x : s[u]) s[v].insert(x);   }   int main() {     scanf( %d%d%d , &n, &m, &Q);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = 1; i <= m; i++) scanf( %d%d , &x_[i], &y_[i]);     for (int i = 1; i <= Q; i++) {       scanf( %d%d , &q[i].op, &q[i].u);       if (q[i].op == 2) vis[q[i].u] = 1;     }     for (int i = 1; i <= n; i++) fa[i] = i, s[i].insert(a[i]);     for (int i = 1; i <= m; i++)       if (!vis[i]) merge(0, x_[i], y_[i]);     for (int i = Q; i; i--)       if (q[i].op == 2) merge(i, x_[q[i].u], y_[q[i].u]);     for (int i = 1; i <= Q; i++)       if (q[i].op == 1) {         int u = find(q[i].u);         if (s[u].empty()) {           puts( 0 );           continue;         }         printf( %d n , *s[u].rbegin());         s[u].erase(*s[u].rbegin());       } else if (q[i].op == 2) {         if (!u_[i]) continue;         int u = u_[i], v = v_[i];         fa[u] = u;         for (it = s[u].begin(); it != s[u].end();) {           itr = s[v].find(*it);           if (itr == s[v].end())             itl = it, it++, s[u].erase(itl);           else             s[v].erase(itr), it++;         }       }     return 0;     return 0;   }   