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.


-----Examples-----
Input
3
1 2 2 1 3 1

Output
2 1 3 1 1 2
Input
1
1 1

Output
-1


-----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.

Difficulty: interview

Starter code:

Solutions:
n = int(input().strip())
arr = list(map(int, input().strip().split()))
if len(set(arr)) == 1:
    print(-1);return()
arr.sort()
print(*arr)

#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

def __starting_point():
    n = int(input())
    a =list(map(int,input().split()))
    a.sort()
    if sum(a[:n]) == sum(a[n:]):
        print(-1)
    else:
        print(' '.join(map(str,a)))
__starting_point()

n=int(input())
l1=list(map(int,input().split()))
if l1.count(l1[0])!=2*n:
    l1.sort()
    print(' '.join(str(x) for x in l1))
else :
    print(-1)

import math
from collections import deque, defaultdict
from sys import stdin, stdout
#input = stdin.readline
# print = stdout.write
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
n = int(input())
a = listin()
a.sort()
if len(set(a)) == 1:
    print(-1)
else:
    print(*a)

from sys import stdin
n=int(stdin.readline().strip())

s=list(map(int,stdin.readline().strip().split()))
s.sort()
if sum(s[0:n])!=sum(s[n:2*n]):
    print(*s)
else:
    print(-1)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
if a[0] == a[-1]:
    print(-1)
else:
    print(*a)

n=int(input())
arr=list(map(int,input().split()))
arr.sort()
if(arr.count(arr[0])==2*n):
	print(-1)
else:
	print(*arr)

N = int(input())
A = [int(a) for a in input().split()]
if min(A) == max(A):
    print(-1)
else:
    print(*sorted(A))


n = int(input())

*l, = map(int, input().split())
if len(set(l)) - 1:
	l.sort()
	print(*l)
else:
	print(-1)

n = int(input())
a = [int(x) for x in input().split()]
x = a[0]
cnt = 0
for y in a:
	if y == x:
		cnt += 1
if cnt == 2 * n:
	print(-1)
else:
	a.sort()
	for x in a:
		print(x, end = ' ')


def main():
    n = int(input())
    a = sorted([int(i) for i in input().split()])
    if sum(a[:n]) == sum(a[n:]):
        print(-1)
    else:
        print(*a)



main()


N = int(input())
A = sorted(list(map(int, input().split())))

if A[0] == A[-1]:
    print(-1)
else:
    print(" ".join(map(str, A)))

n=int(input())
a=list(map(int,input().split()))
a.sort()
if sum(a[:n])!=sum(a[n:]):
    print(*a)
else:
    print(-1)

#Bhargey Mehta (Sophomore)
#DA-IICT, Gandhinagar
import sys, math, queue, bisect
#sys.stdin = open("input.txt", "r")
MOD = 10**9+7
sys.setrecursionlimit(1000000)

n = int(input())
a = list(map(int, input().split()))
a.sort()
if sum(a[:n]) == sum(a[n:]):
    print(-1)
else:
    print(*a)

n = int(input())
a = [int(i) for i in input().split()]
a.sort()
if a[0] == a[-1]:
    print(-1)
else:
    print(*a)

#	!/usr/bin/env python3
#	encoding: UTF-8
#	Modified: <03/Jun/2019 07:37:04 PM>


#	✪ H4WK3yE乡
#	Mohd. Farhan Tahir
#	Indian Institute Of Information Technology (IIIT), Gwalior


import sys


def get_array(): return list(map(int, sys.stdin.readline().split()))


def get_ints(): return list(map(int, sys.stdin.readline().split()))


def input(): return sys.stdin.readline().strip()


def main():
    n = int(input())
    arr = get_array()
    arr.sort()
    if sum(arr[:n]) != sum(arr[n:]):
        print(*arr)
    else:
        print(-1)


def __starting_point():
    main()

__starting_point()

n = int(input())

xs = sorted(map(int, input().split()))

if sum(xs[:n]) != sum(xs[n:]):
    print(' '.join(map(str, xs)))
else:
    print(-1)


n=int(input())
a=list(map(int,input().split()))
a.sort()
if sum(a)==2*sum(a[:n]):
    print(-1)
else:
    print(*a)

n=int(input())
A=list(map(int,input().split()))
A.sort()

if sum(A)==2*sum(A[:n]):
    print(-1)
else:
    print(*A)


import sys
from collections import Counter

def input():
    return sys.stdin.readline().strip()

def rinput():
    return input().split()


def rt(a, s, q):
    if a == s:
        return True
    while a in q:
        a = q[a]
        if a == s:
            return True
    return False
 
def main():
    input()
    a = sorted(list(map(int,input().split())))
    if a[0] != a[-1]:
        print(*a)
    else:
        print(-1)
main()


import sys,math,string
input=sys.stdin.readline
from collections import deque
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : list(map(int,input().split()))
n=int(input())
l=L()
p=set(l)
if(len(p)==1):
    print(-1)
else:
    l.sort()
    print(*l)


import sys
from math import *
from fractions import gcd
readints=lambda:list(map(int, input().strip('\n').split()))

n=int(input())
a=list(readints())
a.sort()
if sum(a[:n])==sum(a[n:]):
    print(-1)
else:
    buf=''
    for x in a:
        buf+=str(x)+' '
    print(buf)


def main():
    n = int(input())
    array = list(map(int,input().split()))
    array.sort()
    first_half = sum(array[:n])
    second_half = sum(array[n:])

    if first_half == second_half:
        print(-1)
        return

    for i in array:
        print(i,end = ' ')

main()


import math
n = int(input())
l = list(map(int, input().split()))
l.sort()
if l.count(l[0]) != 2*n:
    for x in l:
        print(x, end = ' ')
    print()
else:
    print(-1)
        


# python3 c.py

n = int(input())
a = list(map(int, input().split()))
a.sort()
if sum(a[:n]) < sum(a[n:]):
	print(*a)
else:
	print(-1)