#000041

z-niz

Mr. Little Z has his first programming assignment, but he can't solve it. The task is: You're given an array X of N numbers (0< N <= 10000), where every number is on the interval [0..2000000000].


After that, you are given questions defined by three numbers A, B, [], where A, B and C are numbers( (0 < A <= B <= N) and (0 < C <= B-A+1)). For every question write the Cth number of sorted array Y, where elements of array Y = elements XA to XB . In other words, for the given numbers A, B and C output the Cth number from array X[A..B]. Help Mr. Little Z solve the task.


InputThe first line of the standard input contains the number N, where N is the length of array X. Then the next N lines contain N elements, which are the elements of X. The next line contains the number K that represents the number of questions that will be asked, and after that each of the next K lines contain numbers A, B, C representing one question (0 < K <= 80). (Find the Cth element in A..B substring X.

OutputTo the standard output in K lines write K numbers, where every number represents the answer to the question.

Input:
[c]5
1
5
2
4
3
4
2 4 1
2 5 4
1 5 4
2 2 1

Output:
2
5
4
5

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.