Byteasar works at the visitor center of Bytemountains National Park. Bytemountains has n peaks, and some pairs of peaks are joined by trails of varying difficulty.
Tourists keep asking Byteasar the same kind of question: starting from a given peak and walking only along trails whose difficulty does not exceed a chosen limit, what is the height of the k-th highest peak that can be reached?
A peak is reachable from the starting peak when you can walk to it along a sequence of trails, each with difficulty at most the given limit. The starting peak itself is always considered reachable. Help Byteasar answer every question.
The first line contains three integers n, m, and q (1≤n≤100000, 1≤m,q≤500000): the number of peaks, the number of trails, and the number of questions. Peaks are numbered from 1 to n.
The second line contains n integers h1,h2,…,hn (1≤hi≤109), the height of each peak.
Each of the next m lines contains three integers a, b, and c (1≤a,b≤n, a=b, 1≤c≤109), describing a bidirectional trail between peaks a and b with difficulty c; a larger c means a harder trail. Two peaks may be joined by more than one trail.
Each of the next q lines contains three integers v, x, and k (1≤v≤n, 1≤x≤109, 1≤k≤n): starting from peak v and using only trails of difficulty at most x, report the height of the k-th highest reachable peak.
Print q lines. The i-th line must hold the answer to the i-th question: the height of the k-th highest peak reachable under that question's conditions. If fewer than k peaks are reachable, print −1 instead.