Problem: This is an interactive problem.
The jury has hidden a permutation of length .
In one query, you can pick two integers and () by paying coins. In return, you will be given the number of inversions in the subarray .
Find the index of the maximum element in by spending at most coins.
Note: the grader is not adaptive: the permutation is fixed before any queries are made.
A permutation of length is an array consisting of distinct integers from to in arbitrary order. For example, is a permutation, but is not a permutation ( appears twice in the array), and is also not a permutation ( but there is in the array).
The number of inversions in an array is the number of pairs of indices such that and . For example, the array contains inversions. The inversions are , and .
Input Format: Each test contains multiple test cases. The first line of input contains a single integer () — the number of test cases.
The only line of each test case contains a single integer () — the length of the hidden permutation .
It is guaranteed that the sum of over all test cases does not exceed .
Note: In the first test, the interaction proceeds as follows:
SolutionJuryExplanation2There are test cases.4In the first test case, the hidden permutation is , with length .? 1 3 1The solution requests the number of inversions in the subarray by paying coins, and the jury responds with .? 3 4 0The solution requests the number of inversions in the subarray by paying coin, and the jury responds with .! 4 The solution has somehow determined that , and outputs it. Since the output is correct, the jury continues to the next test case.2In the second test case, the hidden permutation is , with length .? 1 2 1The solution requests the number of inversions in the subarray by paying coin, and the jury responds with .! 1 The solution has somehow determined that , and outputs it. Since the output is correct and there are no more test cases, the jury and the solution exit.
Note that the line breaks in the example input and output are for the sake of clarity, and do not occur in the real interaction.