codeforces#P2077A. Breach of Faith

    ID: 36011 远端评测题 2000ms 256MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>constructive algorithmsgreedymathsortings

Breach of Faith

Description

You and your team have worked tirelessly until you have a sequence $a_1, a_2, \ldots, a_{2n+1}$ of positive integers satisfying these properties.

  • $1 \le a_i \le 10^{18}$ for all $1 \le i \le 2n + 1$.
  • $a_1, a_2, \ldots, a_{2n+1}$ are pairwise distinct.
  • $a_1 = a_2 - a_3 + a_4 - a_5 + \ldots + a_{2n} - a_{2n+1}$.

However, the people you worked with sabotaged you because they wanted to publish this sequence first. They deleted one number from this sequence and shuffled the rest, leaving you with a sequence $b_1, b_2, \ldots, b_{2n}$. You have forgotten the sequence $a$ and want to find a way to recover it.

If there are many possible sequences, you can output any of them. It can be proven under the constraints of the problem that at least one sequence $a$ exists.

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains one integer $n$ ($1 \leq n \leq 2 \cdot 10^5$).

The second line of each test case contains $2n$ distinct integers $b_1, b_2, \ldots, b_{2n}$ ($1 \leq b_i \leq 10^9$), denoting the sequence $b$.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.

For each test case, output $2n+1$ distinct integers, denoting the sequence $a$ ($1 \leq a_i \leq 10^{18}$).

If there are multiple possible sequences, you can output any of them. The sequence $a$ should satisfy the given conditions, and it should be possible to obtain $b$ after deleting one element from $a$ and shuffling the remaining elements.

Input

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains one integer $n$ ($1 \leq n \leq 2 \cdot 10^5$).

The second line of each test case contains $2n$ distinct integers $b_1, b_2, \ldots, b_{2n}$ ($1 \leq b_i \leq 10^9$), denoting the sequence $b$.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.

Output

For each test case, output $2n+1$ distinct integers, denoting the sequence $a$ ($1 \leq a_i \leq 10^{18}$).

If there are multiple possible sequences, you can output any of them. The sequence $a$ should satisfy the given conditions, and it should be possible to obtain $b$ after deleting one element from $a$ and shuffling the remaining elements.

4
1
9 2
2
8 6 1 4
3
99 2 86 33 14 77
2
1 6 3 2
7 9 2
1 8 4 6 9
86 99 2 77 69 14 33
4 6 1 2 3