11431143 SUSTech Online Judge
Problem 1143 --Casino Finance Work[Hard]

1143: Casino Finance Work[Hard]

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 1385  Solved: 205
[Submit][Status][Web Board]

Description

Under your help, Joy finally got the job in casino. The boss of the casino is very busy, he can only go to the casino one time every two days. When the boss goes into the casino, he asks Joy to give him the median of the past days’ turnovers. The median is the number in the middle of an array after sorting it. As you know, Joy is not good at math, he asks you for help again!

Now given the turnovers for n days, the boss will come to casino on the first day, and the third day, the fifth day... Please help Joy write a program to output the median of the turnovers when boss comes.

Input

The first line will be an integer T(1 <= T <= 10), which is the number of test cases.

For each test case, the first will be an integer n. Then there will be n integers, a[i].

( 1 <= n <= 300000, 0 <= a[i] <= 300000)

Output

For each test case, output the median every time the boss comes.

Sample Input

1
5
1 2 3 4 5

Sample Output

1 2 3

HINT

Source

 

[Submit][Status]