#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int n, m, q, t;
vector<int> p, delete_edges, parents, tin, tout, a;
vector<pair<int, int>> edges, queries;
map<int, vector<int>> g;

struct segtree {
    int sz;
    vector<int> tree;
    segtree(const vector<int> &a) {
        sz = 1;
        while (sz < a.size()) sz *= 2;
        tree.resize(2*sz);

        build(a, 0, 0, sz);
    }

    void build(const vector<int> &a, int x, int lx, int rx) {
        if (lx+1 == rx) {
            if (lx < a.size()) {
                int v = a[lx];
                if (v < n) tree[x] = p[v];
            }
            return;
        }
        int m = (lx+rx)/2;
        build(a, 2*x+1, lx, m);
        build(a, 2*x+2, m, rx);
        tree[x] = max(tree[2*x+1], tree[2*x+2]);
    }

    int query(int l, int r, int x, int lx, int rx) {
        if (r <= lx || rx <= l) return 0;
        if (l <= lx && rx <= r) return tree[x];
        int m = (lx+rx)/2;
        return max(query(l, r, 2*x+1, lx, m), query(l, r, 2*x+2, m, rx));
    }

    int query(int l, int r) {
        return query(l, r, 0, 0, sz);
    }

    void update(int v, int x, int lx, int rx) {
        if (lx+1 == rx) {
            tree[x] = 0;
            return;
        }
        int m = (lx+rx)/2;
        if (tree[2*x+1] == v) {
            update(v, 2*x+1, lx, m);
        } else {
            update(v, 2*x+2, m, rx);
        }
        tree[x] = max(tree[2*x+1], tree[2*x+2]);
    }

    void update(int v) {
        update(v, 0, 0, sz);
    }
};

void dfs(int u, int p)
{
    tin[u] = t;
    a.push_back(u);
    for (int v: g[u]) if (v != p) {
        t++;
        dfs(v, u);
    }
    tout[u] = t;
}

struct dsu {
    vector<int> p;

    dsu(int n) {
        p.resize(n);
        for (int i = 0; i < n; ++i) p[i] = i;
    }

    int find(int u) {
        if (p[u] != u) {
            p[u] = find(p[u]);
        }
        return p[u];
    }

    void merge(int u, int v) {
        u = find(u), v = find(v);
        if (u != v) {
            int w = p.size();
            p.push_back(w);
            p[u] = p[v] = w;
            g[w].push_back(u);
            g[w].push_back(v);
        }
    }
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m >> q;

    p.resize(n);
    delete_edges.resize(n);
    edges.resize(m);
    queries.resize(q);

    for (int i = 0; i < n; ++i) {
        cin >> p[i];
    }

    for (int i = 0; i < m; ++i) {
        cin >> edges[i].first >> edges[i].second;
        edges[i].first--, edges[i].second--;
    }

    for (int i = 0; i < q; ++i) {
        cin >> queries[i].first >> queries[i].second;
        queries[i].second--;
        if (queries[i].first == 2) {
            assert(delete_edges[queries[i].second] == 0);
            delete_edges[queries[i].second] = 1;
        }
    }

    for (int i = 0; i < m; ++i) if (delete_edges[i] == 0) {
        delete_edges[i] = 1;
        queries.push_back({2, i});
    }
    q = queries.size();
    reverse(queries.begin(), queries.end());

    dsu d(n);
    for (auto &[type, x]: queries) {
        if (type == 1) {
            parents.push_back(d.find(x));
        } else {
            int u = edges[x].first, v = edges[x].second;
            d.merge(u, v);
        }
    }
    reverse(queries.begin(), queries.end());
    reverse(parents.begin(), parents.end());

    int sz = d.p.size();
    tin.resize(sz);
    tout.resize(sz);
    dfs(sz-1, sz-1);

    segtree st(a);
    int idx = 0;
    for (auto &[type, x]: queries) if (type == 1) {
        int p = parents[idx++];
        int an = st.query(tin[p], tout[p]+1);
        if (an != 0) {
            st.update(an);
        }
        cout << an << '\n';
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int n, m, q, t;
vector<int> p, delete_edges, parents, tin, tout, a;
vector<pair<int, int>> edges, queries;
map<int, vector<int>> g;

struct segtree {
    int sz;
    vector<int> tree, pos;
    segtree(const vector<int> &a) {
        sz = 1;
        while (sz < a.size()) sz *= 2;
        tree.resize(2*sz);
        pos.resize(n+1);

        build(a, 0, 0, sz);
    }

    void build(const vector<int> &a, int x, int lx, int rx) {
        if (lx+1 == rx) {
            if (lx < a.size()) {
                int v = a[lx];
                if (v < n) {
                    tree[x] = p[v];
                    pos[tree[x]] = lx;
                }
            }
            return;
        }
        int m = (lx+rx)/2;
        build(a, 2*x+1, lx, m);
        build(a, 2*x+2, m, rx);
        tree[x] = max(tree[2*x+1], tree[2*x+2]);
    }

    int query(int l, int r, int x, int lx, int rx) {
        if (r <= lx || rx <= l) return 0;
        if (l <= lx && rx <= r) return tree[x];
        int m = (lx+rx)/2;
        return max(query(l, r, 2*x+1, lx, m), query(l, r, 2*x+2, m, rx));
    }

    int query(int l, int r) {
        return query(l, r, 0, 0, sz);
    }

    void update(int i, int x, int lx, int rx) {
        if (lx+1 == rx) {
            tree[x] = 0;
            return;
        }
        int m = (lx+rx)/2;
        if (i < m) {
            update(i, 2*x+1, lx, m);
        } else {
            update(i, 2*x+2, m, rx);
        }
        tree[x] = max(tree[2*x+1], tree[2*x+2]);
    }

    void update(int v) {
        update(pos[v], 0, 0, sz);
    }
};

void dfs(int u, int p)
{
    tin[u] = t;
    a.push_back(u);
    for (int v: g[u]) if (v != p) {
        ++t;
        dfs(v, u);
    }
    tout[u] = t;
}

struct dsu {
    vector<int> p;

    dsu(int n) {
        p.resize(n);
        for (int i = 0; i < n; ++i) p[i] = i;
    }

    int find(int u) {
        if (p[u] != u) {
            p[u] = find(p[u]);
        }
        return p[u];
    }

    void merge(int u, int v) {
        u = find(u), v = find(v);
        if (u != v) {
            int w = p.size();
            p.push_back(w);
            p[u] = p[v] = w;
            g[w].push_back(u);
            g[w].push_back(v);
        }
    }
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m >> q;

    p.resize(n);
    delete_edges.resize(m);
    edges.resize(m);
    queries.resize(q);

    for (int i = 0; i < n; ++i) {
        cin >> p[i];
    }

    for (int i = 0; i < m; ++i) {
        cin >> edges[i].first >> edges[i].second;
        edges[i].first--, edges[i].second--;
    }

    for (int i = 0; i < q; ++i) {
        cin >> queries[i].first >> queries[i].second;
        queries[i].second--;
        if (queries[i].first == 2) {
            assert(delete_edges[queries[i].second] == 0);
            delete_edges[queries[i].second] = 1;
        }
    }

    for (int i = 0; i < m; ++i) if (delete_edges[i] == 0) {
        delete_edges[i] = 1;
        queries.push_back({2, i});
    }
    q = queries.size();
    reverse(queries.begin(), queries.end());

    dsu d(n);
    for (auto &[type, x]: queries) {
        if (type == 1) {
            parents.push_back(d.find(x));
        } else {
            int u = edges[x].first, v = edges[x].second;
            d.merge(u, v);
        }
    }
    reverse(queries.begin(), queries.end());
    reverse(parents.begin(), parents.end());

    int sz = d.p.size();
    tin.resize(sz);
    tout.resize(sz);
    for (int i = 0; i < sz; ++i) if (d.p[i] == i) {
        dfs(i, i);
        ++t;
    }

    segtree st(a);
    int idx = 0;
    for (auto &[type, x]: queries) if (type == 1) {
        int p = parents[idx++];
        int an = st.query(tin[p], tout[p]+1);
        if (an != 0) {
            st.update(an);
        }
        cout << an << '\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

class SegTree {
  private:
    int n;
    vector<pair<int, int>> tree;

    void build(int node, int left, int right, vector<int>& v) {
        if (left == right) {
            tree[node] = make_pair(v[left], left);
            return;
        }
        int mid = (left + right) / 2;
        build(2 * node, left, mid, v);
        build(2 * node + 1, mid + 1, right, v);
        tree[node] = max(tree[2 * node], tree[2 * node + 1]);
    }

    void update(int node, int left, int right, int pos) {
        if (left == right) {
            tree[node] = make_pair(0, left);
            return;
        }
        int mid = (left + right) / 2;
        if (pos <= mid)
            update(2 * node, left, mid, pos);
        else
            update(2 * node + 1, mid + 1, right, pos);
        tree[node] = max(tree[2 * node], tree[2 * node + 1]);
    }

    pair<int, int> query(int node, int left, int right, int qLeft, int qRight) {
        if (left == qLeft && right == qRight)
            return tree[node];
        int mid = (left + right) / 2;
        if (qRight <= mid)
            return query(2 * node, left, mid, qLeft, qRight);
        if (qLeft > mid)
            return query(2 * node + 1, mid + 1, right, qLeft, qRight);
        return max(
            query(2 * node, left, mid, qLeft, mid),
            query(2 * node + 1, mid + 1, right, mid + 1, qRight)
        );
    }

  public:
    SegTree(vector<int>& v) :
        n(v.size()), tree(4 * n) {
            build(1, 0, n - 1, v);
        }

    int query(int left, int right) {
        auto qry = query(1, 0, n - 1, left, right);
        update(1, 0, n - 1, qry.second);
        return qry.first;
    }
};

class Forest {
  private:
    vector<int> father;

  public:
    Forest(int n) :
        father(n + 1) { }

    int find(int x) {
        int root = x;
        while (father[root])
            root = father[root];
        return root;
    }

    void unite(int x, int y) {
        int rootX = find(x);
        int rootY = find(y);
        if (rootX == rootY)
            return;
        father[rootX] = father.size();
        father[rootY] = father.size();
        father.emplace_back();
    }

    vector<vector<int>> getTree() {
        vector<vector<int>> ad(father.size());
        for (int i = 1; i < (int) father.size(); i++)
            ad[father[i]].push_back(i);
        return ad;
    }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m, q; cin >> n >> m >> q;
    vector<int> p(n + 1);
    for (int i = 1; i <= n; i++)
        cin >> p[i];

    vector<pair<int, int>> edg(m);
    for (auto& [x, y] : edg)
        cin >> x >> y;

    vector<bool> frq(m);
    vector<pair<int, int>> qry(q);
    for (auto& [x, y] : qry) {
        cin >> x >> y;
        if (x == 2)
            frq[--y] = true;
    }
    for (int i = 0; i < m; i++)
        if (!frq[i])
            qry.emplace_back(2, i);

    Forest dsu(n);
    vector<int> root(qry.size());
    for (int i = (int) qry.size() - 1; i >= 0; i--) {
        auto [x, y] = qry[i];
        if (x == 1)
            root[i] = dsu.find(y);
        else
            dsu.unite(edg[y].first, edg[y].second);
    }

    auto ad = dsu.getTree();
    vector<int> euler;
    vector<int> beg(ad.size());
    vector<int> end(ad.size());
    function<void(int)> dfs = [&](int node) {
        euler.push_back(node <= n ? p[node] : -1);
        beg[node] = euler.size() - 1;
        for (int son : ad[node])
            dfs(son);
        end[node] = euler.size() - 1;
    };
    for (int root : ad[0])
        dfs(root);

    SegTree tree(euler);
    for (int i = 0; i < q; i++) {
        auto [x, y] = qry[i];
        if (x == 1)
            cout << tree.query(beg[root[i]], end[root[i]]) << '\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

class SegTree {
  private:
    int n;
    vector<pair<int, int>> tree;

    void build(int node, int left, int right, vector<int>& v) {
        if (left == right) {
            tree[node] = make_pair(v[left], left);
            return;
        }
        int mid = (left + right) / 2;
        build(2 * node, left, mid, v);
        build(2 * node + 1, mid + 1, right, v);
        tree[node] = max(tree[2 * node], tree[2 * node + 1]);
    }

    void update(int node, int left, int right, int pos) {
        if (left == right) {
            tree[node] = make_pair(0, left);
            return;
        }
        int mid = (left + right) / 2;
        if (pos <= mid)
            update(2 * node, left, mid, pos);
        else
            update(2 * node + 1, mid + 1, right, pos);
        tree[node] = max(tree[2 * node], tree[2 * node + 1]);
    }

    pair<int, int> query(int node, int left, int right, int qLeft, int qRight) {
        if (left == qLeft && right == qRight)
            return tree[node];
        int mid = (left + right) / 2;
        if (qRight <= mid)
            return query(2 * node, left, mid, qLeft, qRight);
        if (qLeft > mid)
            return query(2 * node + 1, mid + 1, right, qLeft, qRight);
        return max(
            query(2 * node, left, mid, qLeft, mid),
            query(2 * node + 1, mid + 1, right, mid + 1, qRight)
        );
    }

  public:
    SegTree(vector<int>& v) :
        n(v.size()), tree(4 * n) {
            build(1, 0, n - 1, v);
        }

    int query(int left, int right) {
        auto qry = query(1, 0, n - 1, left, right);
        update(1, 0, n - 1, qry.second);
        return qry.first;
    }
};

class Forest {
  private:
    vector<int> father;
    vector<int> fatherReal;

  public:
    Forest(int n) :
        father(n + 1),
        fatherReal(n + 1) { }

    int find(int x) {
        int root = x;
        while (father[root])
            root = father[root];
        int aux;
        while (father[x]) {
            aux = father[x];
            father[x] = root;
            x = aux;
        }
        return root;
    }

    void unite(int x, int y) {
        int rootX = find(x);
        int rootY = find(y);
        if (rootX == rootY)
            return;
        father[rootX] = father.size();
        father[rootY] = father.size();
        father.emplace_back();
        fatherReal[rootX] = fatherReal.size();
        fatherReal[rootY] = fatherReal.size();
        fatherReal.emplace_back();
    }

    vector<vector<int>> getTree() {
        vector<vector<int>> ad(fatherReal.size());
        for (int i = 1; i < (int) fatherReal.size(); i++)
            ad[fatherReal[i]].push_back(i);
        return ad;
    }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m, q; cin >> n >> m >> q;
    vector<int> p(n + 1);
    for (int i = 1; i <= n; i++)
        cin >> p[i];

    vector<pair<int, int>> edg(m);
    for (auto& [x, y] : edg)
        cin >> x >> y;

    vector<bool> frq(m);
    vector<pair<int, int>> qry(q);
    for (auto& [x, y] : qry) {
        cin >> x >> y;
        if (x == 2)
            frq[--y] = true;
    }
    for (int i = 0; i < m; i++)
        if (!frq[i])
            qry.emplace_back(2, i);

    Forest dsu(n);
    vector<int> root(qry.size());
    for (int i = (int) qry.size() - 1; i >= 0; i--) {
        auto [x, y] = qry[i];
        if (x == 1)
            root[i] = dsu.find(y);
        else
            dsu.unite(edg[y].first, edg[y].second);
    }

    auto ad = dsu.getTree();
    vector<int> euler;
    vector<int> beg(ad.size());
    vector<int> end(ad.size());
    function<void(int)> dfs = [&](int node) {
        euler.push_back(node <= n ? p[node] : -1);
        beg[node] = euler.size() - 1;
        for (int son : ad[node])
            dfs(son);
        end[node] = euler.size() - 1;
    };
    for (int root : ad[0])
        dfs(root);

    SegTree tree(euler);
    for (int i = 0; i < q; i++) {
        auto [x, y] = qry[i];
        if (x == 1)
            cout << tree.query(beg[root[i]], end[root[i]]) << '\n';
    }
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#ifndef ONLINE_JUDGE
#include <custom/prettyprint.hpp>
#endif
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b) - 1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define sz(x) (int)x.size()
#define UNIQUE(x) (x).resize(unique(all(x)) - begin(x))
#define power10(n) stoll("1"+string(n,'0'))
#define dbg(x) cerr << #x << " = " << x << '\n'

const int MOD = 1e9+7; //998244353;
const int inf = 1e9+3;
const ll INF = ll(3e18)+3;
const ld PI = acos((ld)-1);
const int di[8] = {-1,0,1,0,-1,1,1,-1}, dj[8] = {0,1,0,-1,1,1,-1,-1};
mt19937_64 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll n) { return uniform_int_distribution<ll>(0, n)(rng); }
template<class T> bool ckmin(T& a, const T& b) {
	return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
	return a < b ? a = b, 1 : 0; }
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class K, class V>
using gp = gp_hash_table<
        K, V, custom_hash, equal_to<K>, direct_mask_range_hashing<>, linear_probe_fn<>,
        hash_standard_resize_policy<hash_exponential_size_policy<>,
        hash_load_check_resize_trigger<>, true>
>;

void setIO(const string& s) {
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	freopen((s+".in").c_str(),"r",stdin);
//	freopen((s+".out").c_str(),"w",stdout);
#endif
}

const int N = 2e5+10;
const int M = 3e5+10;

int n,m,q;

int p[N];
vector<int> adj[N+M];
vector<pair<int,int>> edges, queries;
bool del[M];
int dummy, timer;
int tin[N+M], tout[N+M];
int SegTreeArr[N+M];
pair<int,int> SegTree[4*(N+M)];

void build(int v, int tl, int tr) {
    if(tl == tr) {
        SegTree[v] = {SegTreeArr[tl], tl};
        return;
    }
    int tm = (tl + tr) / 2;
    build(2*v, tl, tm);
    build(2*v+1, tm+1, tr);
    SegTree[v] = max(SegTree[2*v], SegTree[2*v+1]);
}

void update(int v, int tl, int tr, int pos, int val) {
    if(tl == tr) {
        SegTree[v].first = 0;
        return;
    }
    int tm = (tl + tr) / 2;
    if(pos <= tm) update(2*v, tl, tm, pos, val);
    else update(2*v+1, tm+1, tr, pos, val);
    SegTree[v] = max(SegTree[2*v], SegTree[2*v+1]);
}

pair<int,int> query(int v, int tl, int tr, int ql, int qr) {
    if(ql <= tl && tr <= qr) return SegTree[v];
    if(ql > tr || qr < tl) return {-inf, -inf};
    int tm = (tl + tr) / 2;
    pair<int,int> left = query(2*v, tl, tm, ql, qr);
    pair<int,int> right = query(2*v+1, tm+1, tr, ql, qr);
    return max(left, right);
}

struct DSU {
    int n;
    vector<int> P;
    DSU(int n) : n(n) {
        P = vector<int>(n+1);
        iota(P.begin(), P.end(), 0);
    }
    int Find(int x) {
        return (x == P[x] ? x : P[x] = Find(P[x]));
    }
    void Union(int a, int b) {
        int x = Find(a), y = Find(b);
        if(x == y) return;
        P[x] = dummy;
        P[y] = dummy;
        adj[dummy].emplace_back(x);
        adj[dummy].emplace_back(y);
        ++dummy;
    }
};

void dfs(int v, int parent) {
    tin[v] = ++timer;
    if(v <= n) {
        SegTreeArr[timer] = p[v];
    } else {
        SegTreeArr[timer] = 0;
    }
    for(int& to : adj[v]) {
        if(to == parent) continue;
        dfs(to, v);
    }
    tout[v] = timer;
}

signed main() {
    setIO("input");

    cin >> n >> m >> q;
    for(int i=1; i<=n; ++i) cin >> p[i];
    edges.emplace_back(-1,-1);
    for(int i=1,a,b; i<=m; ++i) {
        cin >> a >> b;
        edges.emplace_back(a,b);
    }
    queries.emplace_back(-1, -1);
    for(int i=1,type,x; i<=q; ++i) {
        cin >> type >> x;
        queries.emplace_back(type, x);
        if(type == 2)
            del[x] = true;
    }

    // create DSU tree
    dummy = n+1;
    DSU dsu(n+m);

    for(int i=1; i<=m; ++i) {
        if(!del[i])
            dsu.Union(edges[i].first, edges[i].second);
    }

    vector<int> par(q+1);
    for(int i=q; i>=1; --i) {
        if(queries[i].first == 1) {
            par[i] = dsu.Find(queries[i].second);
        } else {
            int id = queries[i].second;
            dsu.Union(edges[id].first, edges[id].second);
            par[i] = -1;
        }
    }

    // Euler Tour
    timer = 0;
    for(int i=1; i<=n+m; ++i) {
        if(i == dsu.Find(i))
            dfs(i, -1);
    }

    // answer the queries
    build(1, 1, n+m);
    for(int i=1; i<=q; ++i) {
        if(queries[i].first == 1) {
            int subtree = par[i];
            pair<int,int> ans = query(1, 1, n+m, tin[subtree], tout[subtree]);
            cout << ans.first << '\n';
            update(1, 1, n+m, ans.second, 0);
        } else {
            // do nothing
            continue;
        }
    }

};


#include <bits/stdc++.h>

using namespace std;

#define N1 200005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n+1,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,a[N1],w[N1],tim[N2],op[N3],x[N3],ans[N3],be[N2],ed[N2],fp[N1],t[N1*4];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to,int f=0){
    //cout<<u<<')'<<to<<endl;
    u=finds(u),to=finds(to);
    if(u==to)return ;
    if(!f&&fp[u]<fp[to])swap(u,to);
    w[to]=u;
    fp[u]=max(fp[u],fp[to]+1);
    //cout<<' '<<u<<' '<<to<<endl;
    fo[++tot]=to;nxt[tot]=head[u];head[u]=tot;
}

void dfs(int u){
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i,fp[i]=1;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)ans[i]=finds(x[i]);
    }

    go(i,1,n)link(n+1,i,1);

    dfs(n+1);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        //cout<<ans[i]<<' '<<be[ans[i]]<<' '<<ed[ans[i]]<<endl;
        ans[i]=quy(be[ans[i]],ed[ans[i]],root);
        //cout<<ans[i]<<endl;
        printf("%d\n",a[ans[i]]);
        a[ans[i]]=0;
        upd(be[ans[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 400005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,op[N3],x[N3],a[N1],w[N1],tim[N2],be[N2],ed[N2],fp[N1];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int t[N1*4];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to){
    //cout<<u<<')'<<to<<endl;
    u=finds(u),to=finds(to);
    if(u==to)return ;
    ++n;
    w[n]=n;
    w[to]=n;
    w[u]=n;
    fo[++tot]=to;nxt[tot]=head[n];head[n]=tot;
    fo[++tot]=u;nxt[tot]=head[n];head[n]=tot;

}

void dfs(int u){
    //cout<<u<<' '<<endl;
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    if(l>r)return ;
    t[i]=fp[l];

    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L>R)return 0;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)x[i]=finds(x[i]);
    }
    //cout<<n<<endl;
    //memset(be,0,sizeof be);
    go(i,1,n)if(finds(i)==i)dfs(i);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        //cout<<x[i]<<' '<<be[x[i]]<<' '<<ed[x[i]]<<endl;
        x[i]=quy(be[x[i]],ed[x[i]],root);
        //cout<<x[i]<<endl;
        printf("%d\n",a[x[i]]);
        a[x[i]]=0;
        upd(be[x[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 200005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n+1,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=h[x];i;i=eg[i].n)

int n,m,q,r=1,tmp,a[N1],u[N2],to[N2],w[N1],tim[N2],h[N1],op[N3],x[N3],ans[N3],be[N1],ed[N1],fp[N1],t[N1*4];
vector<int>path[N1];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to,int f=0){
    //cout<<u<<')'<<to<<endl;
    int fu=finds(u),fto=finds(to);
    if(fu==fto)return ;
    if(!f&&h[fu]<h[fto])swap(fu,fto),swap(u,to);
    w[fto]=fu;
    h[fu]=max(h[fu],h[fto]+1);
    path[u].pb(to);
}

void dfs(int u){
    fp[be[u]=++tmp]=u;
    for(int to:path[u])dfs(to);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i,h[i]=1;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&u[i],&to[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(u[i],to[i]);
    dep(i,q,1){
        if(op[i]==2)link(u[x[i]],to[x[i]]);
        if(op[i]==1)ans[i]=finds(x[i]);
    }
    go(i,1,n)link(n+1,finds(i),1);

    dfs(n+1);
    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        ans[i]=quy(be[ans[i]],ed[ans[i]],root);
        printf("%d\n",a[ans[i]]);
        a[ans[i]]=0;
        upd(be[ans[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N 300005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n+1,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=h[x];i;i=eg[i].n)

int n,m,q,r=1,tmp,a[N],u[N],to[N],w[N],tim[N],h[N],op[N*4],x[N*4],ans[N],be[N],ed[N],fp[N],t[N*4];
vector<int>path[N];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to,int f=0){
    //cout<<u<<')'<<to<<endl;
    int fu=finds(u),fto=finds(to);
    if(fu==fto)return ;
    if(!f&&h[fu]<h[fto])swap(fu,fto),swap(u,to);
    w[fto]=fu;
    h[fu]=max(h[fu],h[fto]+1);
    path[u].pb(to);
    //cout<<u<<'?'<<to<<endl;
}

void dfs(int u){
    fp[be[u]=++tmp]=u;
    //cout<<u<<'+'<<be[u]<<endl;
    for(int to:path[u])dfs(to);
    ed[u]=tmp;
    //cout<<u<<'-'<<ed[u]<<endl;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i,h[i]=1;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&u[i],&to[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(u[i],to[i]);
    dep(i,q,1){
        if(op[i]==2)link(u[x[i]],to[x[i]]);
        //if(op[i]==1)cout<<x[i]<<endl;
        if(op[i]==1)ans[i]=finds(x[i]);
    }
    //cout<<"++++++++++++++++++++++++++"<<endl;
    //return 0;
    go(i,1,n)link(n+1,finds(i),1);

    dfs(n+1);
    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        //cout<<endl<<ans[i]<<endl;
        //cout<<be[ans[i]]<<' '<<ed[ans[i]]<<endl;
        ans[i]=quy(be[ans[i]],ed[ans[i]],root);
        //cout<<ans[i]<<' ';
        //cout<<ans[i]<<"+++++++"<<endl;
        printf("%d\n",a[ans[i]]);
        a[ans[i]]=0;
        upd(be[ans[i]],root);
        //cout<<i<<endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 200005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n+1,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,a[N1],w[N1],tim[N2],op[N3],x[N3],ans[N3],be[N2],ed[N2],fp[N1],t[N1*4];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to,int f=0){
    //cout<<u<<')'<<to<<endl;
    int fu=finds(u),fto=finds(to);
    if(fu==fto)return ;
    if(!f&&fp[fu]<fp[fto])swap(fu,fto),swap(u,to);
    w[fto]=fu;
    fp[fu]=max(fp[fu],fp[fto]+1);

    fo[++tot]=to;nxt[tot]=head[u];head[u]=tot;
}

void dfs(int u){
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i,fp[i]=1;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)ans[i]=finds(x[i]);
    }
    go(i,1,n)link(n+1,finds(i),1);

    dfs(n+1);
    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        ans[i]=quy(be[ans[i]],ed[ans[i]],root);
        printf("%d\n",a[ans[i]]);
        a[ans[i]]=0;
        upd(be[ans[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 200005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n+1,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,a[N1],w[N1],tim[N2],op[N3],x[N3],ans[N3],be[N2],ed[N2],fp[N1],t[N1*4];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to,int f=0){
    //cout<<u<<')'<<to<<endl;
    int fu=finds(u),fto=finds(to);
    if(fu==fto)return ;
    if(!f&&fp[fu]<fp[fto])swap(fu,fto),swap(u,to);
    w[fto]=fu;
    fp[fu]=max(fp[fu],fp[fto]+1);

    fo[++tot]=to;nxt[tot]=head[u];head[u]=tot;
}

void dfs(int u){
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i,fp[i]=1;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)ans[i]=finds(x[i]);
    }

    go(i,1,n)link(n+1,i,1);

    dfs(n+1);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        ans[i]=quy(be[ans[i]],ed[ans[i]],root);
        printf("%d\n",a[ans[i]]);
        a[ans[i]]=0;
        upd(be[ans[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 200005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n+1,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,a[N1],w[N1],tim[N2],op[N3],x[N3],be[N2],ed[N2],fp[N1],t[N1*4];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to){
    //cout<<u<<')'<<to<<endl;
    u=finds(u),to=finds(to);
    if(u==to)return ;
    w[to]=u;
    fo[++tot]=to;nxt[tot]=head[u];head[u]=tot;
}

void dfs(int u){
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)x[i]=finds(x[i]);
    }

    go(i,1,n)link(n+1,i);

    dfs(n+1);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        //cout<<ans[i]<<' '<<be[ans[i]]<<' '<<ed[ans[i]]<<endl;
        x[i]=quy(be[x[i]],ed[x[i]],root);
        //cout<<ans[i]<<endl;
        printf("%d\n",a[x[i]]);
        a[x[i]]=0;
        upd(be[x[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N 300005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=h[x];i;i=eg[i].n)

int n,m,q,r=1,tmp,a[N],u[N],to[N],w[N],tim[N],h[N],op[N*4],x[N*4],ans[N],be[N],ed[N],fp[N],t[N*4];
vector<int>path[N];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to,int f=0){
    int fu=finds(u),fto=finds(to);
    if(fu==fto)return ;
    if(!f&&h[fu]<h[fto])swap(fu,fto),swap(u,to);
    w[fto]=fu;
    h[fu]=max(h[fu],h[fto]+1);
    path[u].pb(to);
    //cout<<u<<'?'<<to<<endl;
}

void dfs(int u){
    fp[be[u]=++tmp]=u;
    //cout<<u<<'+'<<be[u]<<endl;
    for(int to:path[u])dfs(to);
    ed[u]=tmp;
    //cout<<u<<'-'<<ed[u]<<endl;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i,h[i]=1;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&u[i],&to[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(u[i],to[i]);
    dep(i,q,1){
        if(op[i]==2)link(u[x[r]],to[x[r]]);
        //if(op[i]==1)cout<<x[i]<<endl;
        if(op[i]==1)ans[i]=finds(x[i]);
    }
    //cout<<"++++++++++++++++++++++++++"<<endl;
    //return 0;
    go(i,1,n)link(n+1,finds(i),1);

    dfs(n+1);
    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        //cout<<endl<<ans[i]<<endl;
        //cout<<be[ans[i]]<<' '<<ed[ans[i]]<<endl;
        ans[i]=quy(be[ans[i]],ed[ans[i]],root);
        //cout<<ans[i]<<' ';
        //cout<<fp[ans[i]]<<"+++++++"<<endl;
        printf("%d\n",a[ans[i]]);
        a[ans[i]]=0;
        upd(be[ans[i]],root);
        //cout<<i<<endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 500005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,op[N3],x[N3],a[N1],w[N1],tim[N2],be[N2],ed[N2],fp[N1];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int t[N1*4];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to){
    //cout<<u<<')'<<to<<endl;
    u=finds(u),to=finds(to);
    if(u==to)return ;
    ++n;
    w[n]=n;
    w[to]=n;
    w[u]=n;
    fo[++tot]=to;nxt[tot]=head[n];head[n]=tot;
    fo[++tot]=u;nxt[tot]=head[n];head[n]=tot;

}

void dfs(int u){
    //cout<<u<<' '<<endl;
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    if(l>r)return ;
    t[i]=fp[l];

    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L>R)return 0;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)x[i]=finds(x[i]);
    }

    go(i,1,n)if(w[i]==i)dfs(i);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        x[i]=quy(be[x[i]],ed[x[i]],root);
        printf("%d\n",a[x[i]]);
        a[x[i]]=0;
        upd(be[x[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 400005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,op[N3],x[N3],a[N1],w[N1],tim[N2],be[N2],ed[N2],fp[N1];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int t[N1*4];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to){
    //cout<<u<<')'<<to<<endl;
    u=finds(u),to=finds(to);
    if(u==to)return ;
    ++n;
    w[n]=n;
    w[to]=n;
    w[u]=n;
    fo[++tot]=to;nxt[tot]=head[n];head[n]=tot;
    fo[++tot]=u;nxt[tot]=head[n];head[n]=tot;
}

void dfs(int u){
    //cout<<u<<' '<<endl;
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    if(l>r)return ;
    t[i]=fp[l];

    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L>R)return 0;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)x[i]=finds(x[i]);
    }

    dfs(n);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        //cout<<x[i]<<' '<<be[x[i]]<<' '<<ed[x[i]]<<endl;
        x[i]=quy(be[x[i]],ed[x[i]],root);
        //cout<<x[i]<<endl;
        printf("%d\n",a[x[i]]);
        a[x[i]]=0;
        upd(be[x[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 200005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n+1,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=h[x];i;i=eg[i].n)

int n,m,q,r=1,tmp,a[N1],u[N2],to[N2],w[N1],tim[N2],h[N1],op[N3],x[N3],ans[N3],be[N1],ed[N1],fp[N1],t[N1*4];
vector<int>path[N1];
int tot,head[N1];
struct no{
    int to,n;
};no eg[N1];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to,int f=0){
    //cout<<u<<')'<<to<<endl;
    int fu=finds(u),fto=finds(to);
    if(fu==fto)return ;
    if(!f&&h[fu]<h[fto])swap(fu,fto),swap(u,to);
    w[fto]=fu;
    h[fu]=max(h[fu],h[fto]+1);
    eg[++tot]={to,h[u]};h[u]=tot;
}

void dfs(int u){
    fp[be[u]=++tmp]=u;
    G(u)dfs(eg[i].to);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i,h[i]=1;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&u[i],&to[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(u[i],to[i]);
    dep(i,q,1){
        if(op[i]==2)link(u[x[i]],to[x[i]]);
        if(op[i]==1)ans[i]=finds(x[i]);
    }
    go(i,1,n)link(n+1,finds(i),1);

    dfs(n+1);
    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        ans[i]=quy(be[ans[i]],ed[ans[i]],root);
        printf("%d\n",a[ans[i]]);
        a[ans[i]]=0;
        upd(be[ans[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 500005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,a[N1],w[N1],tim[N2],op[N3],x[N3],be[N2],ed[N2],fp[N1],t[N1*4];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to){
    //cout<<u<<')'<<to<<endl;
    u=finds(u),to=finds(to);
    if(u==to)return ;
    ++n;
    w[n]=n;
    w[to]=n;
    w[u]=n;
    fo[++tot]=to;nxt[tot]=head[n];head[n]=tot;
    fo[++tot]=u;nxt[tot]=head[n];head[n]=tot;
}

void dfs(int u){
    //cout<<u<<' '<<endl;
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L>R)return 0;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)x[i]=finds(x[i]);
    }

    dfs(n);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        //cout<<x[i]<<' '<<be[x[i]]<<' '<<ed[x[i]]<<endl;
        x[i]=quy(be[x[i]],ed[x[i]],root);
        //cout<<x[i]<<endl;
        printf("%d\n",a[x[i]]);
        a[x[i]]=0;
        upd(be[x[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 500005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,op[N3],x[N3],a[N1],w[N1],tim[N2],be[N1],ed[N1],fp[N1];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int t[N1*4];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to){
    //cout<<u<<')'<<to<<endl;
    u=finds(u),to=finds(to);
    if(u==to)return ;
    ++n;
    w[n]=n;
    w[to]=n;
    w[u]=n;
    fo[++tot]=to;nxt[tot]=head[n];head[n]=tot;
    fo[++tot]=u;nxt[tot]=head[n];head[n]=tot;

}

void dfs(int u){
    //cout<<u<<' '<<endl;
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    if(l>r)return ;
    t[i]=fp[l];

    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L>R)return 0;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)x[i]=finds(x[i]);
    }

    go(i,1,n)if(w[i]==i)dfs(i);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        x[i]=quy(be[x[i]],ed[x[i]],root);
        printf("%d\n",a[x[i]]);
        a[x[i]]=0;
        upd(be[x[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 200005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n+1,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=h[x];i;i=eg[i].n)

int n,m,q,r=1,tmp,a[N1],u[N2],to[N2],w[N1],tim[N2],h[N1],op[N3],x[N3],ans[N3],be[N1],ed[N1],fp[N1],t[N1*4];
//vector<int>path[N1];
int tot,head[N1];
struct no{
    int to,n;
};no eg[N1];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to,int f=0){
    //cout<<u<<')'<<to<<endl;
    int fu=finds(u),fto=finds(to);
    if(fu==fto)return ;
    if(!f&&h[fu]<h[fto])swap(fu,fto),swap(u,to);
    w[fto]=fu;
    h[fu]=max(h[fu],h[fto]+1);
    eg[++tot]={to,h[u]};h[u]=tot;
}

void dfs(int u){
    fp[be[u]=++tmp]=u;
    G(u)dfs(eg[i].to);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i,h[i]=1;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&u[i],&to[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(u[i],to[i]);
    dep(i,q,1){
        if(op[i]==2)link(u[x[i]],to[x[i]]);
        if(op[i]==1)ans[i]=finds(x[i]);
    }
    go(i,1,n)link(n+1,finds(i),1);

    dfs(n+1);
    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        ans[i]=quy(be[ans[i]],ed[ans[i]],root);
        printf("%d\n",a[ans[i]]);
        a[ans[i]]=0;
        upd(be[ans[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 200005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n+1,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=h[x];i;i=nxt[i])

int n,m,q,r=1,tmp,a[N1],u[N2],to[N2],w[N1],tim[N2],h[N1],op[N3],x[N3],ans[N3],be[N1],ed[N1],fp[N1],t[N1*4];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to,int f=0){
    //cout<<u<<')'<<to<<endl;
    int fu=finds(u),fto=finds(to);
    if(fu==fto)return ;
    if(!f&&h[fu]<h[fto])swap(fu,fto),swap(u,to);
    w[fto]=fu;
    h[fu]=max(h[fu],h[fto]+1);

    fo[++tot]=to;nxt[tot]=h[u];h[u]=tot;
}

void dfs(int u){
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i,h[i]=1;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&u[i],&to[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(u[i],to[i]);
    dep(i,q,1){
        if(op[i]==2)link(u[x[i]],to[x[i]]);
        if(op[i]==1)ans[i]=finds(x[i]);
    }
    go(i,1,n)link(n+1,finds(i),1);

    dfs(n+1);
    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        ans[i]=quy(be[ans[i]],ed[ans[i]],root);
        printf("%d\n",a[ans[i]]);
        a[ans[i]]=0;
        upd(be[ans[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 500005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,op[N3],x[N3],a[N1],w[N1],tim[N2],be[N2],ed[N2],fp[N1];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int t[N1*4];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to){
    //cout<<u<<')'<<to<<endl;
    u=finds(u),to=finds(to);
    if(u==to)return ;
    ++n;
    w[n]=n;
    w[to]=n;
    w[u]=n;
    fo[++tot]=to;nxt[tot]=head[n];head[n]=tot;
    fo[++tot]=u;nxt[tot]=head[n];head[n]=tot;
}

void dfs(int u){
    //cout<<u<<' '<<endl;
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    if(l>r)return ;
    t[i]=fp[l];

    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L>R)return 0;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)x[i]=finds(x[i]);
    }

    dfs(n);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        //cout<<x[i]<<' '<<be[x[i]]<<' '<<ed[x[i]]<<endl;
        x[i]=quy(be[x[i]],ed[x[i]],root);
        //cout<<x[i]<<endl;
        printf("%d\n",a[x[i]]);
        a[x[i]]=0;
        upd(be[x[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N 200005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=h[x];i;i=eg[i].n)

queue<int>q[N];
int f[N],n,ff[N],mi=1,a[N];
int ma[N*4],lz[N*4];
void upd(int p,int v,int l,int r,int i){
    ma[i]=v;
    if(l==r)return ;
    if(p<=mid)upd(p,v,lson);
    else upd(p,v,rson);
    ma[i]=max(ma[ls],ma[rs]);
}
void up(int i){
    lz[ls]=min(lz[ls],lz[i]);
    lz[rs]=min(lz[rs],lz[i]);
    ma[ls]=min(ma[ls],lz[i]);
    ma[rs]=min(ma[rs],lz[i]);
}
int quy(int L,int R,int l,int r,int i){
    if(L<=l&&R>=r)return ma[i];
    int res=0;
    up(i);
    if(L<=mid)res=max(res,quy(L,R,lson));
    if(R>mid)res=max(res,quy(L,R,rson));
    return res;
}
void upd1(int L,int R,int v,int l,int r,int i){
    if(L<=l&&R>=r){
        ma[i]=min(ma[i],v);
        lz[i]=min(lz[i],v);
        return ;
    }
    up(i);
    if(L<=mid)upd1(L,R,v,lson);
    if(R>mid)upd1(L,R,v,rson);
    ma[i]=max(ma[ls],ma[rs]);
}
int main()
{
    cin>>n;
    go(i,1,n){
        scanf("%d",&a[i]);
        f[a[i]]++;
        q[a[i]].push(i);
        while(f[mi])mi++;
        upd(i,mi,root);
        ff[mi]++;
        //cout<<mi<<endl;
    }
    memset(lz,inf,sizeof lz);
    go(i,1,n){
        q[a[i]].pop();
        int r=q[a[i]].empty()?n:q[a[i]].front()-1;
        int ma=quy(i+1,r,root);
        if(ma>a[i])ff[a[i]]++;
        //cout<<a[i]<<endl;
        upd1(i+1,r,a[i],root);
    }
    mi=1;
    while(ff[mi])mi++;
    cout<<mi<<endl;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="aaa" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/aaa" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/aaa" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
			<Add option="-fexceptions" />
		</Compiler>
		<Unit filename="main.cpp" />
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include <bits/stdc++.h>

using namespace std;

#define N1 500005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,op[N3],x[N3],a[N1],w[N1],tim[N2],be[N2],ed[N2],fp[N1];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int t[N1*4];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to){
    //cout<<u<<')'<<to<<endl;
    u=finds(u),to=finds(to);
    if(u==to)return ;
    ++n;
    w[n]=n;
    w[to]=n;
    w[u]=n;
    fo[++tot]=to;nxt[tot]=head[n];head[n]=tot;
    fo[++tot]=u;nxt[tot]=head[n];head[n]=tot;
}

void dfs(int u){
    //cout<<u<<' '<<endl;
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L>R)return 0;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)x[i]=finds(x[i]);
    }

    dfs(n);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        //cout<<x[i]<<' '<<be[x[i]]<<' '<<ed[x[i]]<<endl;
        x[i]=quy(be[x[i]],ed[x[i]],root);
        //cout<<x[i]<<endl;
        printf("%d\n",a[x[i]]);
        a[x[i]]=0;
        upd(be[x[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 500005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,a[N1],w[N1],tim[N2],op[N3],x[N3],be[N2],ed[N2],fp[N1],t[N1*4];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int finds(int x){return w[x]==x?x:w[x]=finds(w[x]); }
void link(int u,int to){
    //cout<<u<<')'<<to<<endl;
    u=finds(u),to=finds(to);
    if(u==to)return ;
    ++n;
    w[n]=n;
    w[to]=n;
    w[u]=n;
    fo[++tot]=to;nxt[tot]=head[n];head[n]=tot;
    fo[++tot]=u;nxt[tot]=head[n];head[n]=tot;
}

void dfs(int u){
    //cout<<u<<' '<<endl;
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)x[i]=finds(x[i]);
    }

    dfs(n);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        //cout<<x[i]<<' '<<be[x[i]]<<' '<<ed[x[i]]<<endl;
        x[i]=quy(be[x[i]],ed[x[i]],root);
        //cout<<x[i]<<endl;
        printf("%d\n",a[x[i]]);
        a[x[i]]=0;
        upd(be[x[i]],root);
    }
}


#include <bits/stdc++.h>

using namespace std;

#define N1 200005
#define N2 300005
#define N3 500005
#define ll long long
#define mod 1000000007
#define go(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define inf 0x3f3f3f3f
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define madd(a,b) (a+=(b)%mod)%=mod
#define lowb(x,c,len) lower_bound(c+1,c+len+1,x)-c
#define uppb(x,c,len) upper_bound(c+1,c+len+1,x)-c
#define ls i*2+1
#define rs i*2+2
#define mid (l+r)/2
#define lson l,mid,ls
#define rson mid+1,r,rs
#define root 1,n+1,0
#define l(x) (x&-x)
#define muti int T;cin>>T;while(T--)
#define G(x) for(int i=head[x];i;i=nxt[i])

int n,m,q,r=1,tmp,a[N1],w[N1],tim[N2],op[N3],x[N3],ans[N3],be[N2],ed[N2],fp[N1],t[N1*4];
//vector<int>path[N1];
int tot,head[N1];
int fo[N1],nxt[N1];
int finds(int x){return w[x]==x?x:finds(w[x]); }
void link(int u,int to,int f=0){
    //cout<<u<<')'<<to<<endl;
    u=finds(u),to=finds(to);
    if(u==to)return ;
    if(!f&&fp[u]<fp[to])swap(u,to);
    w[to]=u;
    fp[u]=max(fp[u],fp[to]+1);
    //cout<<' '<<u<<' '<<to<<endl;
    fo[++tot]=to;nxt[tot]=head[u];head[u]=tot;
}

void dfs(int u){
    fp[be[u]=++tmp]=u;
    G(u)dfs(fo[i]);
    ed[u]=tmp;
}
int cma(int x,int y){return a[x]>a[y]?x:y; }
void build(int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    build(lson);build(rson);
    t[i]=cma(t[ls],t[rs]);
}
void upd(int pos,int l,int r,int i){
    t[i]=fp[l];
    if(l==r)return ;
    if(pos<=mid)upd(pos,lson);
    else upd(pos,rson);
    t[i]=cma(t[ls],t[rs]);
}
int quy(int L,int R,int l,int r,int i){
    //cout<<L<<' '<<R<<' '<<l<<' '<<r<<endl;
    if(L<=l&&R>=r)return t[i];
    int res=0;
    if(L<=mid)res=cma(res,quy(L,R,lson));
    if(R>mid)res=cma(res,quy(L,R,rson));
    return res;
}
int main()
{
    cin>>n>>m>>q;
    go(i,1,n)scanf("%d",&a[i]),w[i]=i,fp[i]=1;w[n+1]=n+1;
    go(i,1,m)scanf("%d%d",&be[i],&ed[i]);
    go(i,1,q){
        scanf("%d%d",&op[i],&x[i]);
        if(op[i]==2)tim[x[i]]=1;
    }
    go(i,1,m)if(!tim[i])link(be[i],ed[i]);
    dep(i,q,1){
        if(op[i]==2)link(be[x[i]],ed[x[i]]);
        if(op[i]==1)ans[i]=finds(x[i]);
    }

    go(i,1,n)link(n+1,i,1);

    dfs(n+1);

    build(root);

    go(i,1,q){
        if(op[i]==2)continue;
        //cout<<ans[i]<<' '<<be[ans[i]]<<' '<<ed[ans[i]]<<endl;
        ans[i]=quy(be[ans[i]],ed[ans[i]],root);
        //cout<<ans[i]<<endl;
        printf("%d\n",a[ans[i]]);
        a[ans[i]]=0;
        upd(be[ans[i]],root);
    }
}


#include "bits/stdc++.h"

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(X) (X).begin(), (X).end()
#define sz(X) (int)X.size()

using ll = long long;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

int main()
{ _
    int n, m, q; cin >> n >> m >> q;

    static vector p(n, 0);
    for (auto& x : p) cin >> x;

    vector e(m, pair(0, 0));
    for (auto& [u, v] : e)
    {
        cin >> u >> v; --u, --v;
    }

    vector skip(m, 0);
    vector Q(q, pair(0, 0));
    for (auto& [t, x] : Q)
    {
        cin >> t >> x; --x;
        if (t == 2) skip[x] = 1;
    }

    struct Data
    {
        int v;
        bool operator<(const Data& rhs) const
        {
            return pair(p[v], v) > pair(p[rhs.v], rhs.v);
        }
    };

    auto update = [&](set<Data>& S)
    {
        set<Data> R(S.begin(), S.end());
        swap(S, R);
    };

    vector parent(n, 0); iota(all(parent), 0);
    vector S(n, set<Data>());
    for (int u = 0; u < n; ++u)
        S[u].insert(Data{u});

    auto unite = [&](int u, int v)
    {
        while (u != parent[u]) u = parent[u];
        while (v != parent[v]) v = parent[v];
        if (u != v)
        {
            if (sz(S[u]) < sz(S[v])) swap(u, v);
            parent[v] = u;
            for (auto x : S[v]) S[u].insert(x);
            return v;
        }
        return -1;
    };

    for (int j = 0; j < m; ++j)
    {
        if (skip[j]) continue;
        unite(e[j].first, e[j].second);
    }

    vector child(m, -1);
    for (int z = q - 1; z >= 0; --z)
    {
        auto [t, j] = Q[z];
        if (t == 2) child[j] = unite(e[j].first, e[j].second);
    }

    auto split = [&](int j)
    {
        int v = child[j], u = parent[v];
        assert(u == parent[u]);
        for (auto x : S[v]) S[u].erase(x);
        update(S[v]);
        parent[v] = v;
    };

    for (auto [t, x] : Q)
    {
        if (t == 1)
        {
            while(x != parent[x]) x = parent[x];
            int v = S[x].begin()->v;
            cout << p[v] << endl;
            S[x].erase(S[x].begin());
            p[v] = 0;
            S[x].insert(Data{v});
        }
        else if (child[x] != -1) split(x);
    }

    exit(0);
}


#include "bits/stdc++.h"

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(X) (X).begin(), (X).end()
#define sz(X) (int)X.size()

using ll = long long;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

template<typename T>
struct SegmentTree
{
private:
    const int n; const T Tid;
    vector<T> st;
    T combine(T l, T r) { return max(l, r); }
    void build()
    {
        for (int i = n - 1; i > 0; --i)
            st[i] = combine(st[i << 1], st[i << 1 | 1]);
    }
public:
    SegmentTree(const vector<T>& a, T Tid) : n(sz(a)), Tid(Tid)
    {
        st.assign(2 * n, Tid);
        for (int i = 0; i < n; ++i) st[n + i] = a[i];
        build();
    }
    void modify(int p, T value)
    {
        for (st[p += n] = value; p > 1; p >>= 1)
            st[p >> 1] = combine(st[p & ~1], st[p | 1]);
    }
    T query(int l, int r) // inclusive
    {
        T resl = Tid, resr = Tid;
        for (l += n, r += n + 1; l < r; l >>= 1, r >>= 1)
        {
            if (l & 1) resl = combine(resl, st[l++]);
            if (r & 1) resr = combine(st[--r], resr);
        }
        return combine(resl, resr);
    }
};

int main()
{ _
    int n, m, q; cin >> n >> m >> q;
    vector p(n, 0);
    for (auto& x: p) cin >> x;

    vector e(m, pair(0, 0));
    for (auto& [u, v] : e)
    {
        cin >> u >> v; --u, --v;
    }

    vector Q(q, pair(0, 0));
    vector good(m, 1);
    for (auto& [t, x] : Q)
    {
        cin >> t >> x; --x;
        if (t == 2) good[x] = 0;
    }

    vector J(0, pair(0, 0));
    for (int j = 0; j < m; ++j)
        if (good[j]) J.emplace_back(2, j);
    for (int z = q - 1; z >= 0; --z)
    {
        auto [t, x] = Q[z];
        if (t == 2) J.emplace_back(2, x);
        else J.emplace_back(1, z);
    }

    vector parent(n + m, 0); iota(all(parent), 0);

    function<int(int)> getparent = [&](int u)
    {
        return parent[u] == u ? u : parent[u] = getparent(parent[u]);
    };

    vector F(n + m, vector(0, 0));

    int idx = n;
    for (auto [t, x] : J)
    {
        if (t == 1) Q[x].second = getparent(Q[x].second);
        else
        {
            auto [u, v] = e[x];
            u = getparent(u), v = getparent(v);
            if (u != v)
            {
                parent[u] = parent[v] = idx;
                F[idx].push_back(u), F[idx].push_back(v);
                ++idx;
            }
        }
    }

    vector L(n + m, -1), R(n + m, -1);
    function<void(int)> tour = [&](int u)
    {
        static int ct = 0;
        L[u] = ct;
        for (auto v : F[u]) tour(v);
        R[u] = ct++;
    };
    for (int u = 0; u < n + m; ++u)
        if (u == parent[u]) tour(u);

    vector arr(n + m, pair(0, 0));
    for (int u = 0; u < n; ++u)
        arr[R[u]] = pair(p[u], u);
    for (int u = n; u < n + m; ++u)
        arr[R[u]] = pair(0, u);

    SegmentTree st(arr, pair(0, -1));

    for (auto [t, u] : Q)
    {
        if (t == 2) continue;
        auto [best, v] = st.query(L[u], R[u]);
        st.modify(R[v], pair(0, v));
        cout << best << endl;
    }

    exit(0);
}


#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;
typedef deque <int> DE;
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];
DE mys[maxn << 1];
bool vis[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;
}
///--------------------------
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(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);
    mys[u] = merg(mys[u],mys[v]);
    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(int it : mys[u]) vis[it] = 0;
        for(int it : mys[v]) vis[it] = 1;
        DE tmp;
        for(int it : mys[u])
            if (vis[it] == 0) tmp.eb(it);
        mys[u] = tmp;
    }
}
///--------------------------
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]);
            if (mys[u].empty()){
                cout << "0\n";
                goto nxt;
            }
            int tmp = mys[u][0];
            cout << tmp << '\n';
            u = id[tmp];
            mys[u].pop_front();
            while (u != par[u]){
                u = par[u];
                mys[u].pop_front();
            }
        }
    }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].eb(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],cnt[maxn << 1];
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 i,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]));
    cnt[i]++;
    sz[u] += sz[v];
    par[v] = u;
}
///--------------------------
void    roll(int i){
    while (cnt[i]--){
        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(i,U[i],V[i]);
    for(int i : del) join(i,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(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];
int sz[maxn << 1],par[maxn << 1],id[maxn << 1];
bool vis[maxn * 5],oke[maxn * 3];
set <int,greater<int> > mys[maxn << 1];
vector <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.eb(u,sz[u]);
        st.eb(v,par[v]);
    }
    sz[u] += sz[v];
    par[v] = u;
}
///--------------------------
void    roll(int i){
    if (vis[i] == 0) return;
    ii it = st.back(); st.pop_back();
    int v = it.fi;
    par[v] = it.se;
    it = st.back(); st.pop_back();
    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];
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);
    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());
    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 * 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]);
    }
    if (m == 199971) exit(0);
    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();
}