#582. 「Nowcoder多校 2019 Day3」Median
「Nowcoder多校 2019 Day3」Median
当前没有测试数据。
题目描述
JSB has an integer sequence . He wants to play a game with SHB.
For each , JSB calculates the median of , denoted by bib_ibi. SHB is given the sequence . Can you help him restore the sequence ?
Recall that the median of three numbers is the second largest one of them.
输入格式
There are multiple cases. The first line of the input contains a single positive integer , indicating the number of cases.
For each case, the first line of the input contains a single integer , the length of the sequence . The second line contains integers .
It's guaranteed that the sum of n\ n n over all cases does not exceed .
输出格式
For each case print one line containing integers, indicating the sequence . Your output must satisfy for each .
If there are multiple valid answers, you may print any of them. If there is no valid answer, print"-1" (without quotes) instead.
样例
样例输入 1
4
5
1 2 3
6
1 2 3 4
6
1 2 4 3
6
1 3 4 2
样例输出 1
1 1 3 2 3
1 2 1 4 3 4
1 1 4 2 4 3
-1