Problem: Mocha likes arrays, so before her departure, Chamo gave her an array consisting of positive integers as a gift.
Mocha doesn't like arrays containing different numbers, so Mocha decides to use magic to change the array. Mocha can perform the following three-step operation some (possibly, zero) times:
- Choose indices and ()
- Let be the median of the subarray
- Set all values to
Suppose initially:
- If Mocha chooses in the first operation, then , the array will be changed into .
- If Mocha chooses in the first operation, then , the array will be changed into .
Mocha will perform the operation until the array contains only the same number. Mocha wants to know what is the maximum possible value of this number.
The median in an array of length is an element that occupies position number after we sort the elements in non-decreasing order. For example, the median of is and the median of is .
Input Format: Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The first line of each test case contains a single integer () — the length of the array .
The second line of each test case contains integers () — the elements of the array .
It is guaranteed that the sum of over all test cases does not exceed .
Output Format: For each test case, output the maximum value of the number.
Note: In the first test case, . Mocha can only choose the interval . The array will be changed to . Therefore, the answer is .
In the second test case, Mocha can perform the following operations:
- Choose the interval , then .
- Choose the interval , then .
- Choose the interval , then .
The array contains only the same number, which is . It can be proven that the maximum value of the final number cannot be greater than .