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

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


#include <bits/stdc++.h>

#define rep(a, b)   for(int a = 0; a < (b); ++a)
#define all(a)      (a).begin(),(a).end()
#define endl        '\n'

using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);

    int n,m,q; cin>>n>>m>>q;
    vector weights(n,0);
    rep(i,n) cin>>weights[i];

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

    vector<pair<int,int>> evt(q);
    for(auto& [t,i] : evt) cin>>t>>i, --i;

    // for each event that produces a split, contains smaller side
    vector<vector<int>> smaller(q);
    vector parent(n,0);
    vector<vector<int>> comp(n);
    rep(i,n) parent[i] = i, comp[i].push_back(i);
    auto merge = [&](int u, int v, int evt_id = -1) {
        auto r1 = parent[u], r2 = parent[v];
        if(r1==r2) return;
        if(size(comp[r1])>size(comp[r2])) swap(r1,r2);
        if(evt_id!=-1) smaller[evt_id] = comp[r1];
        for(auto i : comp[r1]) parent[i] = r2;
        comp[r2].insert(end(comp[r2]), all(comp[r1]));
    };
    vector always(m,true);
    for(auto [t,i] : evt) if(t==2) always[i] = false;
    rep(i,m) if(always[i]) merge(edges[i].first, edges[i].second);
    for(int i=q-1; i>=0; --i) {
        auto [t,e] = evt[i];
        if(t==1) continue;
        auto [u,v] = edges[e];
        merge(u,v,i);
    }

    vector<set<pair<int,int>>> vals(n); // val, id
    rep(i,n) vals[parent[i]].emplace(weights[i],i);

    rep(evt_id, q) {
        auto [t,i] = evt[evt_id];
        if(t==1) {
            auto& s = vals[parent[i]];
            if(empty(s)) cout << 0 << endl;
            else {
                auto it = prev(end(s));
                cout << it->first << endl;
                weights[it->second] = 0;
                s.erase(it);
            }
        } else {
            if(empty(smaller[evt_id])) continue;
            auto [u,v] = edges[i];
            auto old_rep = parent[u];
            auto new_rep = find(all(smaller[evt_id]),u)!=end(smaller[evt_id]) ? u : v;
            for(auto k : smaller[evt_id]) {
                parent[k] = new_rep;
                if(weights[k]) {
                    vals[old_rep].erase({weights[k],k});
                    vals[new_rep].insert({weights[k],k});
                }
            }
        }
    }

    return 0;
}

