#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long power(long long x, long long p, long long MOD) {
  if (p == 0) return 1 % MOD;
  if (p == 1) return x % MOD;
  long long res = power(x, p / 2, MOD);
  res = (long long)res * res % MOD;
  if (p & 1) res = (long long)res * x % MOD;
  return res;
}
const long long N = 200010;
const long long M = 500005;
struct Query {
  long long type, id;
};
long long no_inv[N], label[N];
long long root(long long u) { return no_inv[u]; }
struct Node;
long long node_ptr = 0;
Node* no;
struct Node {
  vector<long long> m, children;
  long long poll(long long id) {
    long long res = 0;
    while (!m.empty()) {
      long long u = m.back();
      m.pop_back();
      if (no_inv[u] == id && label[u]) {
        res = label[u];
        label[u] = 0;
        break;
      }
    }
    return res;
  }
  void split() {
    assert(!children.empty());
    long long child = children.back();
    for (long long x : no[child].m) {
      no_inv[x] = child;
    }
    children.pop_back();
  }
};
long long make_node() { return node_ptr++; }
pair<long long, long long> ed[M];
bool deleted[M];
Query qrs[M];
long long ans[M];
vector<long long> adj[N];
bool vis[N];
long long dfs_node;
void dfs(long long u) {
  if (vis[u]) return;
  vis[u] = 1;
  no[dfs_node].m.push_back(u);
  no_inv[u] = dfs_node;
  for (long long v : adj[u]) dfs(v);
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, m, q;
  cin >> n >> m >> q;
  no = new Node[N];
  for (long long i = 0; i < n; i++) {
    cin >> label[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> ed[i].first >> ed[i].second;
    ed[i].first--, ed[i].second--;
  }
  for (long long i = 0; i < q; i++) {
    cin >> qrs[i].type >> qrs[i].id;
    qrs[i].id--;
    if (qrs[i].type == 2) deleted[qrs[i].id] = true;
  }
  for (long long i = 0; i < m; i++) {
    if (!deleted[i]) {
      adj[ed[i].first].push_back(ed[i].second);
      adj[ed[i].second].push_back(ed[i].first);
    }
  }
  for (long long i = 0; i < n; i++) {
    if (!vis[i]) {
      dfs_node = make_node();
      dfs(i);
    }
  }
  memset(deleted, 0, sizeof deleted);
  for (long long i = q - 1; i >= 0; i--) {
    if (qrs[i].type == 2) {
      pair<long long, long long>& e = ed[qrs[i].id];
      long long a = root(e.first), b = root(e.second);
      if (a != b) {
        if (no[a].m.size() < no[b].m.size()) swap(a, b);
        no[a].children.push_back(b);
        copy((no[b].m).begin(), (no[b].m).end(), back_inserter(no[a].m));
        for (long long x : no[b].m) no_inv[x] = a;
        deleted[qrs[i].id] = true;
      }
    }
  }
  for (long long i = 0; i < node_ptr; i++) {
    sort((no[i].m).begin(), (no[i].m).end(),
         [](long long a, long long b) { return label[a] < label[b]; });
  }
  for (long long i = 0; i < q; i++) {
    if (qrs[i].type == 1) {
      long long u = qrs[i].id;
      u = root(u);
      cout << no[u].poll(u) << "\n";
    } else if (deleted[qrs[i].id]) {
      long long u = root(ed[qrs[i].id].first);
      no[u].split();
    }
  }
}

### Prompt

Create a solution in Cpp for the following problem:

You are given an undirected graph consisting of n vertices and m edges. Initially there is a single integer written on every vertex: the vertex i has p_i written on it. All p_i are distinct integers from 1 to n.

You have to process q queries of two types:

  * 1 v — among all vertices reachable from the vertex v using the edges of the graph (including the vertex v itself), find a vertex u with the largest number p_u written on it, print p_u and replace p_u with 0; 
  * 2 i — delete the i-th edge from the graph. 



Note that, in a query of the first type, it is possible that all vertices reachable from v have 0 written on them. In this case, u is not explicitly defined, but since the selection of u does not affect anything, you can choose any vertex reachable from v and print its value (which is 0). 

Input

The first line contains three integers n, m and q (1 ≤ n ≤ 2 ⋅ 10^5; 1 ≤ m ≤ 3 ⋅ 10^5; 1 ≤ q ≤ 5 ⋅ 10^5).

The second line contains n distinct integers p_1, p_2, ..., p_n, where p_i is the number initially written on vertex i (1 ≤ p_i ≤ n).

Then m lines follow, the i-th of them contains two integers a_i and b_i (1 ≤ a_i, b_i ≤ n, a_i ≠ b_i) and means that the i-th edge connects vertices a_i and b_i. It is guaranteed that the graph does not contain multi-edges.

Then q lines follow, which describe the queries. Each line is given by one of the following formats:

  * 1 v — denotes a query of the first type with a vertex v (1 ≤ v ≤ n). 
  * 2 i — denotes a query of the second type with an edge i (1 ≤ i ≤ m). For each query of the second type, it is guaranteed that the corresponding edge is not deleted from the graph yet. 

Output

For every query of the first type, print the value of p_u written on the chosen vertex u.

Example

Input


5 4 6
1 2 5 4 3
1 2
2 3
1 3
4 5
1 1
2 1
2 3
1 1
1 2
1 2


Output


5
1
2
0

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long power(long long x, long long p, long long MOD) {
  if (p == 0) return 1 % MOD;
  if (p == 1) return x % MOD;
  long long res = power(x, p / 2, MOD);
  res = (long long)res * res % MOD;
  if (p & 1) res = (long long)res * x % MOD;
  return res;
}
const long long N = 200010;
const long long M = 500005;
struct Query {
  long long type, id;
};
long long no_inv[N], label[N];
long long root(long long u) { return no_inv[u]; }
struct Node;
long long node_ptr = 0;
Node* no;
struct Node {
  vector<long long> m, children;
  long long poll(long long id) {
    long long res = 0;
    while (!m.empty()) {
      long long u = m.back();
      m.pop_back();
      if (no_inv[u] == id && label[u]) {
        res = label[u];
        label[u] = 0;
        break;
      }
    }
    return res;
  }
  void split() {
    assert(!children.empty());
    long long child = children.back();
    for (long long x : no[child].m) {
      no_inv[x] = child;
    }
    children.pop_back();
  }
};
long long make_node() { return node_ptr++; }
pair<long long, long long> ed[M];
bool deleted[M];
Query qrs[M];
long long ans[M];
vector<long long> adj[N];
bool vis[N];
long long dfs_node;
void dfs(long long u) {
  if (vis[u]) return;
  vis[u] = 1;
  no[dfs_node].m.push_back(u);
  no_inv[u] = dfs_node;
  for (long long v : adj[u]) dfs(v);
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, m, q;
  cin >> n >> m >> q;
  no = new Node[N];
  for (long long i = 0; i < n; i++) {
    cin >> label[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> ed[i].first >> ed[i].second;
    ed[i].first--, ed[i].second--;
  }
  for (long long i = 0; i < q; i++) {
    cin >> qrs[i].type >> qrs[i].id;
    qrs[i].id--;
    if (qrs[i].type == 2) deleted[qrs[i].id] = true;
  }
  for (long long i = 0; i < m; i++) {
    if (!deleted[i]) {
      adj[ed[i].first].push_back(ed[i].second);
      adj[ed[i].second].push_back(ed[i].first);
    }
  }
  for (long long i = 0; i < n; i++) {
    if (!vis[i]) {
      dfs_node = make_node();
      dfs(i);
    }
  }
  memset(deleted, 0, sizeof deleted);
  for (long long i = q - 1; i >= 0; i--) {
    if (qrs[i].type == 2) {
      pair<long long, long long>& e = ed[qrs[i].id];
      long long a = root(e.first), b = root(e.second);
      if (a != b) {
        if (no[a].m.size() < no[b].m.size()) swap(a, b);
        no[a].children.push_back(b);
        copy((no[b].m).begin(), (no[b].m).end(), back_inserter(no[a].m));
        for (long long x : no[b].m) no_inv[x] = a;
        deleted[qrs[i].id] = true;
      }
    }
  }
  for (long long i = 0; i < node_ptr; i++) {
    sort((no[i].m).begin(), (no[i].m).end(),
         [](long long a, long long b) { return label[a] < label[b]; });
  }
  for (long long i = 0; i < q; i++) {
    if (qrs[i].type == 1) {
      long long u = qrs[i].id;
      u = root(u);
      cout << no[u].poll(u) << "\n";
    } else if (deleted[qrs[i].id]) {
      long long u = root(ed[qrs[i].id].first);
      no[u].split();
    }
  }
}

```