Given a sequence A = a1, ..., aN, answer Q queries.
In the i-th query, you are given three integers Li, Ri, and Ki, and have to find the Ki-th largest mode of A[Li...Ri].
It is guaranteed for each i = 1, ..., Q - 1, Li - 3 ≤ Li+1 and Ri - 3 ≤ Ri+1.
scanf and printf are recommended over cin and cout to speed up input and output.
The first line of the input contains an integer T, the number of testcases.
The first line of each testcase contains two integers N and Q, the length of A and the number of queries.
The second line of each testcase contains N integers, a1, ..., aN, the sequence A.
Each of the next Q lines contains three integers Li, Ri, and Ki, the range and the order of the mode to report for the i-th query.
Constraints
There are five subtasks. For each subtask,
In every subtask, 1 ≤ T ≤ 10, 1 ≤ ai ≤ 109, 1 ≤ Li ≤ Ri ≤ N, and 1 ≤ Ki ≤ 3.
For each query in each testcase, please print the Ki-th largest mode of A[Li...Ri] followed by a newline.
If such value does not exist, print -1 instead.