9 5 14
7 1 4 8 5 2 6 9 3
2 8
1 6
5 7
1 3
3 9
1 5
1 8
1 5
1 4
1 8
1 3
1 5
1 5
1 7
1 7
2 3
1 2
1 1
1 2
 6 5 8
1 2 6 3 4 5
2 4
1 3
1 6
3 5
2 5
1 1
1 4
1 1
2 1
2 5
2 2
2 3
1 4
 2 1 3
1 2
1 2
1 1
1 1
1 1

6
9
5
8
1
7
0
0
0
0
0
4
0
 6
5
4
3
 2
1
0

#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> e;
vector<int> op, num;
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  vector<int> p(n);
  for (int i = 0; i < n; ++i) scanf("%d", &p[i]);
  for (int i = 0, x, y; i < m; ++i) {
    scanf("%d%d", &x, &y), --x, --y;
    e.emplace_back(make_pair(x, y));
  }
  vector<int> del(m);
  for (int i = 0, x, y; i < q; ++i) {
    scanf("%d%d", &x, &y), --y;
    op.emplace_back(x);
    num.emplace_back(y);
    if (x == 2) del[y] = 1;
  }
  for (int i = 0; i < m; ++i)
    if (!del[i]) {
      op.emplace_back(2);
      num.emplace_back(i);
    }
  q = (int)op.size();
  vector<int> pre(n);
  vector<vector<int>> cnt(n);
  for (int i = 0; i < n; ++i) {
    pre[i] = i;
    cnt[i] = {i};
  }
  vector<vector<int>> cnt1(q);
  vector<int> pre1(q);
  for (int i = q - 1; i >= 0; --i)
    if (op[i] == 2) {
      int x = e[num[i]].first, y = e[num[i]].second;
      if (pre[x] == pre[y]) continue;
      x = pre[x];
      y = pre[y];
      if (cnt[y].size() > cnt[x].size()) swap(x, y);
      pre1[i] = y;
      cnt1[i] = cnt[y];
      for (auto v : cnt[y]) {
        cnt[x].emplace_back(v);
        pre[v] = x;
      }
      cnt[y] = {};
    }
  vector<set<int>> w(n);
  for (int i = 0; i < n; ++i) w[pre[i]].insert(p[i]);
  for (int i = 0; i < q; ++i) {
    if (op[i] == 1) {
      int x = pre[num[i]];
      if (w[x].empty())
        printf("0\n");
      else {
        printf("%d\n", *(--w[x].end()));
        w[x].erase(--w[x].end());
      }
    } else {
      int x = pre[e[num[i]].first];
      int y = pre1[i];
      for (auto v : cnt1[i]) {
        if (w[x].count(p[v])) {
          w[x].erase(p[v]);
          w[y].insert(p[v]);
        }
        pre[v] = y;
      }
    }
  }
  return 0;
}
