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

n, m, q = map(int, input().split())

p = list(map(int, input().split()))


r = []

for i in range(m):
    a, b = map(int, input().split())
    r.append([a-1, b-1])

qs = []
for i in range(q):
    a, b = map(int, input().split())
    qs.append([a, b-1])

cd = [[[p[i], i]] for i in range(n)]
ind = [[i] for i in range(n)]

for a, b in r:
    cd[a].append([p[b], b])
    cd[b].append([p[a], a])
    ind[a].append(b)
    ind[b].append(a)
for ll in cd:
    ll.sort(reverse=True)

def mrm(v):
    pn = p[v]
    for u in ind[v]:
        cd[u].remove([pn, v])

def p1(v):
    if cd[v] == []:
        return 0
    res = cd[v][0][0]
    vg = cd[v][0][1]
    mrm(vg)
    return res


def p2(i):
    a, b = r[i]
    if [p[b], b] in cd[a]:
        cd[a].remove([p[b], b])
    if [p[a], a] in cd[b]:
        cd[b].remove([p[a], a])
    ind[a].remove(b)
    ind[b].remove(a)

def pp(a, b):
    if a==1:
        print(p1(b))
    else:
        p2(b)

for a, b in qs:
    pp(a, b)

