Codeforces Round 563 (Div. 2)
A
Ehab Fails to Be Thanos
Codeforces
1000
原题
←B →
翻译中…

You're given an array $a$ of length $2n$. Is it possible to reorder it in such way so that the sum of the first $n$ elements isn't equal to the sum of the last $n$ elements?

翻译中…

Input

翻译中…

The first line contains an integer $n$ ($1 \le n \le 1000$), where $2n$ is the number of elements in the array $a$.

翻译中…

The second line contains $2n$ space-separated integers $a_1$, $a_2$, $\ldots$, $a_{2n}$ ($1 \le a_i \le 10^6$) — the elements of the array $a$.

翻译中…

Output

翻译中…

If there's no solution, print "-1" (without quotes). Otherwise, print a single line containing $2n$ space-separated integers. They must form a reordering of $a$. You are allowed to not change the order.

翻译中…

Note

翻译中…

In the first example, the first $n$ elements have sum $2+1+3=6$ while the last $n$ elements have sum $1+1+2=4$. The sums aren't equal.

翻译中…

In the second example, there's no solution.

翻译中…

样例

Input #1
3
1 2 2 1 3 1
Output #1
2 1 3 1 1 2
InputCopy OutputCopy
Input #2
1
1 1
Output #2
-1
InputCopy OutputCopy
题目信息
题号
1174A
时间限制
1 s
内存限制
256 MB
标签
构造
贪心
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。