# 部分点2 import sys from collections import deque input = sys.stdin.readline N,M,Q = map(int, input().split()) A = list(map(int, input().split())) A = [x-1 for x in A] G = [[] for _ in range(N)] W = {0} # 答えは0かw_jなので、添字で二分探索できる for i in range(M): u,v,w = map(int, input().split()) G[u-1].append((v-1,w)) G[v-1].append((u-1,w)) W.add(w) W = sorted(W) for i in range(Q): s,c = map(int, input().split()) s-=1 ok=len(W) ng=-1 while(ok-ng>1): mid = (ok+ng)//2 D=W[mid] visited = [0]*N flag = [0]*N visited[s]=True flag[A[s]]=True que = deque([s]) t=1 while que and t=c: break if t>=c: ok=mid else: ng=mid if ok == len(W): print(-1) else: print(W[ok])