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.

Source: codeforces | Difficulty: EASY
Tags: Greedy algorithms

Sorting

Constructive algorithms


Solutions:
n = int(input())
x = list(map(int, input().split()))
sum1 = 0
sum2 = 0
equal = True
i = 0
while i < 2 * n - 1:
	if x[i] != x[i + 1] and equal:
		equal = False
	if i < n:
		sum1 += x[i]
	else:
		sum2 += x[i]
	i += 1
sum2 += x[i]
if equal:
	print(-1)
else:
	i = n
	j = 0
	if sum1 == sum2:
		while j < n:
			if x[j] != x[i]:
				tmp = x[j]
				x[j] = x[i]
				x[i] = tmp
				break
			elif i == 2 * n - 1:
				i = n
				j += 1
			else:
				i += 1
	for i in x:
		print(i, end=' ')


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


n = int(input())
arr = list(map(int, input().split()))

def sol(n):
	arr.sort()
	if arr[0] == arr[-1]:
		print(-1)
	else:
		print(*arr)
sol(n)


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


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


n = int(input())
arr = [int(i) for i in input().split()]
if sum(arr[:n]) == sum(arr[n:]):
	arr = sorted(arr)
	if sum(arr[:n]) == sum(arr[n:]):
		print(-1)
	else:
		print(' '.join((str(i) for i in arr)))
else:
	print(' '.join((str(i) for i in arr)))


(_, ls) = (input(), sorted(map(int, input().split())))
print(*(ls if ls.count(ls[0]) < len(ls) else [-1]))


t = int(input())
A = list(map(int, input().split()))
A = sorted(A)
if sum(A[:t]) == sum(A[t:]):
	print(-1)
else:
	print(*A)


from sys import stdin

def input():
	return stdin.readline().strip()
import math
n = int(input())
l = list(map(int, input().split()))
if l.count(l[0]) == 2 * n:
	print(-1)
else:
	print(*sorted(l))


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


n = int(input())
c = list(map(int, input().split()))
sum1 = 0
sum2 = 0
temp = 0
d = ''
for i in range(n):
	sum1 = sum1 + c[i]
	sum2 = sum2 + c[i + n]
if sum1 != sum2:
	for m in range(2 * n):
		d = d + str(c[m]) + ' '
	print(d[:-1])
else:
	for j in range(n):
		if len(d) == 0:
			for k in range(n):
				if c[j] != c[k + n]:
					temp = c[j]
					c[j] = c[k + n]
					c[k + n] = temp
					for m in range(2 * n):
						d = d + str(c[m]) + ' '
					print(d[:-1])
					break
if len(d) == 0:
	print(-1)


a = int(input())
ar = sorted(list(map(int, input().split())))
if ar[:a] != ar[a:]:
	print(' '.join(map(str, ar)))
else:
	print(-1)


n = int(input())
arr = list(map(int, input().split()))
if len(set(arr)) == 1:
	print(-1)
else:
	print(*sorted(arr))


x = int(input())
s = [int(n) for n in input().split()]
s.sort()
if min(s) == max(s):
	print(-1)
elif sum(s[:x // 2]) != sum(s[x // 2:]):
	for n in s:
		print(n, end=' ')
else:
	t = s[0]
	s[0] = s[x - 1]
	s[x - 1] = t
	for n in s:
		print(n, end=' ')


from sys import stdin
import heapq
import collections
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
arr.sort()
if sum(arr[:n]) != sum(arr[n:]):
	print(*arr)
else:
	print(-1)


n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)
if len(set(a)) != 1:
	print(*a)
else:
	print(-1)


n = int(input())
ar = sorted([int(i) for i in input().split()])
si = 0
sf = 0
for i in range(n):
	si += ar[i]
	sf += ar[2 * n - 1 - i]
if si != sf:
	print(' '.join([str(i) for i in ar]))
else:
	print(-1)


n = int(input())
l = sorted([int(x) for x in input().split(' ')])
if sum(l[:n]) != sum(l[n:]):
	print(*l)
else:
	print(-1)


n = int(input())
arr = input()
arr = arr.split(' ')
if len(set(arr)) == 1:
	print(-1)
else:
	print(' '.join(sorted(arr)))


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)


from math import *
n = int(input()) * 2
a = list(map(int, input().split(' ')))
a = sorted(a)
if sum(a[:n // 2]) == sum(a[n // 2:]):
	print(-1)
else:
	print(*a)


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


n = int(input())
l = list(map(int, input().split()))
if len(set(l)) == 1:
	print(-1)
else:
	for i in sorted(l):
		print(i, end=' ')
	print()


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


data = []
n = int(input())
data[:] = map(int, input().split())
f = 1
for i in range(2 * n - 1):
	if data[i] != data[i + 1]:
		f = 0
if f:
	print(-1)
else:
	data.sort()
	for i in data:
		print(i, end=' ')


n = int(input())
mass = list(map(int, input().split()))
i = 0
counter = 0
while sum(mass[:n]) == sum(mass[n:]) and i != n + 1:
	if mass[i] != mass[len(mass) - 1 - i]:
		(mass[i], mass[len(mass) - 1 - i]) = (mass[len(mass) - 1 - i], mass[i])
		i += 1
	else:
		counter += 1
		i += 1
if counter == n + 1:
	(mass[0], mass[-2]) = (mass[-2], mass[0])
if i == n + 1 and sum(mass[:n]) == sum(mass[n:]):
	print('-1')
else:
	print(*mass)


n = int(input())
a = list(map(int, input().split()))
sum_1 = sum(a[:n])
sum_2 = sum(a[n:])
if sum_1 != sum_2:
	print(*a)
else:
	s1 = a[:n]
	s2 = a[n:]
	(s1, s2) = (sorted(s1), sorted(s2))
	(s1[0], s2[-1]) = (s2[-1], s1[0])
	if sum(s1) == sum(s2):
		print(-1)
	else:
		s1.extend(s2)
		print(*s1)


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


t = int(input())
a = input().split(' ')
l = list(map(int, a))
s = set(l)
if len(s) == 1:
	print('-1')
else:
	l.sort()
	for i in l:
		print(i, end=' ')


n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
su = 0
su2 = 0
for i in range(n):
	su += a[i]
for j in range(n, 2 * n):
	su2 += a[j]
if su == su2:
	print(-1)
else:
	for i in a:
		print(i, end=' ')
	print('')


def foo():
	a = int(input())
	b = [int(i) for i in str(input()).split(' ')]
	if len(set(b)) == 1:
		return ['-1']
	b.sort()
	b = [str(i) for i in b]
	return b
print(' '.join(foo()))


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


def solve(n, nums):
	nums.sort()
	s1 = sum(nums[:n])
	s2 = sum(nums[n:])
	if s1 != s2:
		return ' '.join(map(str, nums))
	x = nums[0]
	found = False
	for i in range(n, 2 * n):
		if nums[i] != nums[0]:
			(nums[0], nums[i]) = (nums[i], nums[0])
			found = True
			break
	if found:
		return ' '.join(map(str, nums))
	return '-1'
n = int(input())
nums = list(map(int, input().split()))
print(solve(n, nums))


n = int(input())
a = [int(i) for i in input().split()]
if len(set(a)) <= 1:
	print(-1)
else:
	for i in range(n):
		if sum(a[:n]) == sum(a[n:]):
			for j in range(n):
				if a[i] != a[n + j]:
					(a[i], a[n + j]) = (a[n + j], a[i])
					break
		else:
			break
	print(' '.join([str(i) for i in a]))


N = int(input())
ls = list(map(int, input().split()))
ls.sort()
if len(set(ls)) == 1:
	print(-1)
else:
	for i in ls:
		print(i, end=' ')
	print()


N = int(input())
A = list(map(int, input().strip().split()))
A.sort()
B = []
C = []
x = 0
for i in range(N):
	B.append(A[i])
	C.append(A[N + i])
if len(set(A)) == 1:
	print('-1')
else:
	print(*B, end=' ')
	print(*C)


n = int(input())
l = list(map(int, input().split()))
l.sort()
sum1 = 0
sum2 = 0
for i in range(n):
	sum1 = sum1 + l[i]
	sum2 = sum2 + l[2 * n - 1 - i]
if sum1 == sum2:
	print('-1')
else:
	for i in range(2 * n):
		print(l[i], end=' ')


n = int(input())
a = [int(x) for x in input().split(' ')]
s = 0
for x in a:
	s += x
if s % 2 == 1:
	print(' '.join([str(x) for x in a]))
else:
	a.sort()
	s1 = 0
	for x in range(len(a) // 2):
		s1 += a[x]
	if s1 == s // 2:
		print(-1)
	else:
		print(' '.join([str(x) for x in a]))


n = int(input())
l1 = list(map(int, input().split()))
l1.sort()
if sum(l1[:n]) == sum(l1[n:]):
	print(-1)
else:
	for i in range(len(l1)):
		print(l1[i], end=' ')


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


n = int(input().strip())
nums = list(map(int, input().strip().split()))
nums.sort()
first_sum = sum(nums[:n])
last_sum = sum(nums[n:])
if first_sum != last_sum:
	print(' '.join(map(str, nums)))
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
if sum(a[:n]) == sum(a[n:]):
	print(-1)
else:
	for i in a:
		print(i, end=' ')


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


n = int(input())
l = sorted(list(map(int, input().split())))
if l[0] == l[-1]:
	print(-1)
else:
	print(' '.join(map(str, l)))


n = int(input())
a = [int(x) for x in input().split()]
s1 = sum(a[:n])
s2 = sum(a[n:])
if s1 != s2:
	print(*a)
elif min(a) == max(a):
	print(-1)
else:
	a.sort()
	print(*a)


n = int(input())
arr = sorted(map(int, input().strip().split()))
if sum(arr[:n]) == sum(arr[n:]):
	print(-1)
else:
	print(*arr)


n = int(input())
a = list(map(int, input().split()))
flag = False
f = a[0]
for q in a:
	if f != q:
		flag = True
		break
if not flag:
	print(-1)
else:
	a.sort()
	for q in a:
		print(q, end=' ')
	print('')


def cin():
	return map(int, input().split())

def cino(test=False):
	if not test:
		return int(input())
	else:
		return input()

def cina():
	return list(map(int, input().split()))

def ssplit():
	return list(input().split())

def printlist(l):
	for i in l:
		print(i, end=' ')
n = cino()
l = cina()
l.sort()
(sum1, sum2) = (0, 0)
for i in range(n):
	sum1 += l[i]
	sum2 += l[i + n]
if sum1 != sum2:
	printlist(l)
else:
	print(-1)


import sys
inf = float('inf')
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

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

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

def input():
	return sys.stdin.readline().strip()
n = int(input())
Arr = get_array()
Arr.sort()
if sum(Arr[:n]) == sum(Arr[n:]):
	print(-1)
else:
	print(*Arr, sep=' ')


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


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


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


def main():
	l = int(input())
	numbers = list(map(int, input().split()))
	numbers.sort()
	print(-1) if sum(numbers[:l]) == sum(numbers[l:]) else print(*numbers)
main()


n = int(input())
array = list(map(int, input().split()))
array.sort()
max1 = max(array)
max2 = array[0]
if max1 == max2:
	print(-1)
	exit
else:
	for i in range(2 * n):
		print(array[i], end=' ')


n = int(input())
ar = list(map(int, input().split()))
s = set(ar)
if len(s) == 1:
	print(-1)
else:
	ar.sort()
	print(*ar)


a = int(input())
x = sorted(list(map(int, input().strip().split())))
(low, high) = (sum(x[:a]), sum(x[a:]))
if low == high:
	print(-1)
else:
	print(*x)


a = int(input())
list1 = input().split()
for i in range(len(list1)):
	list1[i] = int(list1[i])
list1.sort()
if list1.count(list1[0]) != 2 * a:
	for i in range(len(list1)):
		if i != 2 * a - 1:
			print(list1[i], end=' ')
		else:
			print(list1[i])
else:
	print(-1)


def swap(ls, a, b):
	c = ls[a]
	ls[a] = ls[b]
	ls[b] = c

def A_Ehab_Fails_to_Be_Thanos(num: int):
	right_max_index = num
	right_min_index = num
	left_max_index = 0
	left_min_index = 0
	total1 = 0
	total2 = 0
	length = 2 * num
	i = 0
	d_list = input().split(' ')
	while i < length:
		if i < num:
			if int(d_list[left_min_index]) > int(d_list[i]):
				left_min_index = i
			if int(d_list[left_max_index]) < int(d_list[i]):
				left_max_index = i
			total1 += int(d_list[i])
		else:
			if int(d_list[right_min_index]) > int(d_list[i]):
				right_min_index = i
			if int(d_list[right_max_index]) < int(d_list[i]):
				right_max_index = i
			total2 += int(d_list[i])
		i += 1
	if total1 != total2:
		for i in d_list:
			print(i, end=' ')
		return
	if int(d_list[left_max_index]) == int(d_list[left_min_index]) == int(d_list[right_max_index]) == int(d_list[right_min_index]):
		print(-1)
		return
	elif int(d_list[left_min_index]) != int(d_list[right_min_index]):
		swap(d_list, left_min_index, right_min_index)
	elif int(d_list[left_max_index]) != int(d_list[right_max_index]):
		swap(d_list, left_max_index, right_max_index)
	elif int(d_list[left_max_index]) != int(d_list[right_min_index]):
		swap(d_list, left_max_index, right_min_index)
	elif int(d_list[left_min_index]) != int(d_list[right_max_index]):
		swap(d_list, left_min_index, right_max_index)
	for i in d_list:
		print(i, end=' ')
A_Ehab_Fails_to_Be_Thanos(int(input()))


def reordering(L):
	m = len(L)
	for i in range(m - 1):
		if L[i] != L[i + 1]:
			break
	else:
		return -1
	Sum1 = 0
	Sum2 = 0
	for i in range(m // 2):
		Sum1 += L[i]
	for j in range(m // 2, m):
		Sum2 += L[j]
	if Sum1 != Sum2:
		return L
	L.sort()
	return L
t = int(input())
arr = list(map(int, input().split()))
X = reordering(arr)
if X != -1:
	for x in X:
		print(x, end=' ')
else:
	print(X)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
(sum1, sum2) = (0, 0)
for i in range(n):
	sum1 = sum1 + a[i]
for i in range(n, 2 * n):
	sum2 = sum2 + a[i]
if sum2 == sum1:
	print(-1)
else:
	for i in a:
		print(i, end=' ')


x = int(input())
str_in = input()
num = [int(n) for n in str_in.split()]
num = sorted(num)
sum1 = sum2 = 0
for i in range(x):
	sum1 += num[i]
for i in range(x, 2 * x):
	sum2 += num[i]
if sum1 != sum2:
	for i in range(2 * x):
		print(num[i], end=' ')
else:
	print('-1')


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


def printList(x):
	for i in x:
		print('{} '.format(i), end='')

def boolPossible(x):
	flag = x[0]
	for i in x:
		if i != flag:
			x.sort()
			printList(x)
			return
	print('-1')

def main():
	t = int(input().strip())
	lineinp = input().strip()
	arr = list(map(int, lineinp.split()))
	boolPossible(arr)
main()


n = int(input())
mylist = [int(x) for x in input().split()]
mylist.sort()
if mylist[0] == mylist[len(mylist) - 1]:
	print('-1')
else:
	mylist = [str(x) for x in mylist]
	print(' '.join(mylist))


n = int(input())
arr = [int(x) for x in input().split(' ')]
sum_1 = 0
sum_2 = 0
for i in range(0, n):
	sum_1 += arr[i]
for i in range(n, 2 * n):
	sum_2 += arr[i]
if sum_1 == sum_2:
	for i in range(0, n):
		for j in range(n, 2 * n):
			if arr[i] != arr[j]:
				temp = arr[i]
				arr[i] = arr[j]
				arr[j] = temp
				print(' '.join((str(x) for x in arr)))
				exit(0)
else:
	print(' '.join((str(x) for x in arr)))
	exit(0)
print(-1)


n = int(input())
l = list(map(int, input().split()))
x = True
d = {}
for i in l:
	d[i] = 0
for i in l:
	d[i] += 1
for i in d:
	if d[i] == 2 * n:
		x = False
		break
if x == False:
	print(-1)
else:
	l.sort()
	st = ''
	for i in l:
		st += str(i) + ' '
	print(st)


n = int(input())
a = list(map(int, input().split()))
a.sort()
kq = 0
(st, ss) = (a[0], a[n])
for i in range(1, n):
	st = st + a[i]
	ss = ss + a[i + n]
	if ss > st:
		break
if st == ss:
	print(-1)
else:
	for i in range(2 * n):
		print(a[i], end=' ')


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


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


def pr(a):
	ans = ''
	for i in range(len(a)):
		ans += str(a[i]) + ' '
	return ans
n = int(input())
a = sorted(list(map(int, input().split())))
if sum(a[:n]) == sum(a[n:]):
	print(-1)
else:
	print(pr(a))


n = int(input())
a = [*map(int, input().split())]
a.sort()
ans = 0
for i in range(0, n):
	ans += a[i]
su = sum(a) - ans
if su == ans:
	print(-1)
else:
	for j in range(0, 2 * n):
		print(a[j], end=' ')


t = int(input())
arr = list(map(int, input().split()))
s = set(arr)
if len(s) == 1:
	print(-1)
else:
	arr.sort()
	print(*arr)


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
n = int(input())
a = list(map(int, input().split()))
if len(set(a)) == 1:
	print(-1)
else:
	print(*sorted(a))


import sys, collections
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
if len(set(arr)) == 1:
	print(-1)
else:
	print(' '.join(map(str, sorted(arr))))


a = int(input())
line = [int(x) for x in input().split()]
line = sorted(line)

def splitList(list):
	half = len(list) // 2
	return (list[:half], list[half:])
(b, c) = splitList(line)
if sum(b) == sum(c):
	(b[0], c[len(c) - 1]) = (c[len(c) - 1], b[0])
	if sum(b) == sum(c):
		print('-1')
	else:
		print(*line)
else:
	print(*line)


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 = [int(x) for x in input().split()]
a.sort()
print(' '.join(map(str, a)) if sum(a[:n]) != sum(a[n:]) else -1)


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


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


n = int(input())
a = list(map(int, input().split()))
s = set(a)
if len(s) == 1:
	print(-1)
else:
	a.sort()
	for i in range(2 * n):
		print(a[i], end=' ')


n = int(input())
a = input().split()
for i in range(2 * n):
	a[i] = int(a[i])
flag = True
for i in range(2 * n):
	if a[i] != a[0]:
		flag = False
if flag:
	print(-1)
else:
	a.sort()
	print(*a)


n = int(input())
a = [int(x) for x in input().strip().split()]
a.sort()
c = a[:n]
d = a[n:2 * n]
if sum(c) == sum(d):
	print(-1)
else:
	for _ in a:
		print(_, end=' ')
	print()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	n = I()
	a = sorted(LI())
	if sum(a[:n]) != sum(a[n:]):
		return ' '.join(map(str, a))
	return -1
print(main())


n = int(input())
l = list(map(int, input().split()))
l.sort()
s1 = sum(l[0:n])
s2 = sum(l[n:2 * n])
if s1 == s2:
	print(-1)
if s1 != s2:
	print(*l)


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


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
s = 0
for i in range(n):
	s += lst[i]
if 2 * s == sum(lst):
	print(-1)
else:
	lstrs = []
	for i in lst:
		lstrs.append(str(i))
	print(' '.join(lstrs))


n = int(input())
a = [int(v) for v in input().split()]
a.sort()
l = []
r = []
sum_l = 0
sum_r = 0
for i in range(n):
	l.append(a[i])
	sum_l += a[i]
	r.append(a[-(i + 1)])
	sum_r += a[-(i + 1)]
if sum_l == sum_r:
	print(-1)
else:
	for v in l + r:
		print(v, end=' ')


n = int(input())
L = list(map(int, input().split()))
if sum(L[:n]) == sum(L[n:]) and min(L[:n]) == max(L[n:]):
	print(-1)
elif sum(L[:n]) != sum(L[n:]):
	print(' '.join(map(str, L)))
else:
	pos1 = L[:n].index(min(L[:n]))
	pos2 = L[n:].index(max(L[n:])) + n
	(L[pos1], L[pos2]) = (L[pos2], L[pos1])
	print(' '.join(map(str, L)))


n = int(input())
numbers = list(map(int, input().split()))

def call():
	a = numbers[0]
	sum1 = 0
	sum2 = 0
	flag = 0
	for num in numbers:
		if num != a:
			flag = 1
			break
	if flag == 0:
		print(-1)
		return
	for i in range(n):
		sum1 += numbers[i]
	for i in range(n, 2 * n):
		sum2 += numbers[i]
	if sum1 == sum2:
		for i in range(n):
			for j in range(n, n * 2):
				if numbers[i] != numbers[j]:
					temp = numbers[i]
					numbers[i] = numbers[j]
					numbers[j] = temp
					for k in range(2 * n):
						print(numbers[k], end=' ')
					return
	for i in range(2 * n):
		print(numbers[i], end=' ')
	return
call()


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


x = input()
y = sorted([*map(int, input().split())])
if y[0] == y[-1]:
	print('-1')
else:
	print(*y)


n = int(input())
na = input()
na = na.split()
s = 0
for i in range(0, len(na)):
	na[i] = eval(na[i])
na.sort()
for i in range(0, n):
	s = s + na[i] - na[n + i]
if s == 0:
	print(-1)
else:
	na = ' '.join((str(x) for x in na))
	print(na)


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


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


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi
import heapq

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_right(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		l = list(In())
		l.sort()
		(su, su1) = (0, 0)
		for x in range(n):
			su += l[x]
		for x in range(n, 2 * n):
			su1 += l[x]
		q = 0
		if su == su1:
			for x in range(n):
				if l[x] != l[n - x - 1]:
					(l[x], l[n - x - 1]) = (l[n - x - 1], l[x])
					q = 1
		if su != su1:
			print(*l)
		elif q == 1:
			print(*l)
		else:
			print(-1)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


n = int(input())
q = False
a = input().split()
for i in range(2 * n):
	a[i] = int(a[i])
a1 = sorted(a[0:n])
a2 = sorted(a[n:2 * n])
if sum(a1) == sum(a2):
	for i in range(n):
		for j in range(n):
			if a1[i] != a2[j]:
				(a1[i], a2[j]) = (a2[j], a1[i])
				q = True
				break
		if q:
			break
else:
	q = True
if q:
	for i in a1:
		print(i, end=' ')
	for i in range(n - 1):
		print(a2[i], end=' ')
	print(a2[n - 1])
else:
	print('-1')


n = int(input())
m = list(map(int, input().split()))
m.sort()
(a, b) = (0, 0)
for i in range(n):
	a += m[i]
for i in range(n, 2 * n):
	b += m[i]
if a == b:
	print(-1)
else:
	for i in range(2 * n):
		print(m[i], end=' ')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
from collections import *
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def main():
	n = ii()
	arr = li()
	arr = sorted(arr)
	(s1, s2) = (0, 0)
	for i in range(0, 2 * n, 1):
		if i < n:
			s1 += arr[i]
		else:
			s2 += arr[i]
	if s1 != s2:
		print(*arr)
	else:
		ch = arr[0]
		for i in range(n, 2 * n, 1):
			if ch != arr[i]:
				(arr[0], arr[i]) = (arr[i], arr[0])
				print(*arr)
				break
		else:
			print(-1)
main()


n = int(input())
l = list(map(int, input().split()))
suma = 0
for i in range(n):
	suma += l[i]
if suma * 2 != sum(l):
	for i in range(2 * n):
		print(l[i], end=' ')
else:
	c = 0
	for i in range(n, 2 * n):
		if l[i] != l[0]:
			a = l[i]
			b = l[0]
			l[0] = a
			l[i] = b
			c = 1
			break
	if c == 0:
		for i in range(n):
			if l[i] != l[0]:
				a = l[i]
				b = l[n]
				l[i] = b
				l[n] = a
				c = 1
				break
	if c == 0:
		print(-1)
	else:
		for i in range(2 * n):
			print(l[i], end=' ')


def solution(arr):
	if len(set(arr)) == 1:
		return -1
	arr.sort()
	return ' '.join(arr)
n = int(input())
arr = [_ for _ in input().split()]
print(solution(arr))


n = int(input())
a = [int(i) for i in input().split()]
s1 = s2 = 0
a.sort()
for i in range(n):
	s1 += a[i]
for i in range(n, 2 * n):
	s2 += a[i]
if s1 == s2:
	print(-1)
else:
	print(*a)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n,) = I()
l = I()
l.sort()
if sum(l) == sum(l[:n]) * 2:
	print(-1)
else:
	print(*l)


n = int(input())
a = list(map(int, input().split()))
a.sort()
i = 0
while a[:n] == a[n:] and i < n:
	(a[i], a[-i - 1]) = (a[-i - 1], a[i])
	i += 1
if a[:n] == a[n:]:
	print(-1)
else:
	print(*a)


f = input()
arr = [int(i) for i in input().split()]
arr.sort(reverse=True)
mid = int(len(arr) / 2)
if sum(arr[:mid]) == sum(arr[mid:]):
	print(-1)
else:
	print(' '.join([str(i) for i in arr]))


n = int(input())
a = [int(s) for s in input().split()]
q = 0
w = 0
e = 0
for i in range(n):
	w += a[i]
	e += a[n + i]
if w != e:
	(a[0], a[1]) = (a[1], a[0])
	q = 1
for i in range(n):
	if q == 0:
		for j in range(n):
			if a[i] != a[n + j]:
				q = 1
				(a[i], a[n + j]) = (a[n + j], a[i])
				break
	else:
		break
if q == 1:
	print(*a)
else:
	print(-1)


n = int(input())
A = list(map(int, input().split()))
A.sort()
sum1 = 0
sum2 = 0
for i in range(n):
	sum1 += A[i]
	sum2 += A[i + n]
if sum1 == sum2:
	print('-1')
else:
	print(*A)


n = int(input())
l = list(map(int, input().split()))
flag = False
if sum(l[:n]) == sum(l[n:]):
	for i in range(n):
		for j in range(n):
			if l[i] != l[n + j]:
				(l[i], l[n + j]) = (l[n + j], l[i])
				flag = True
				print(*l)
				break
		if flag:
			break
	else:
		print(-1)
else:
	print(*l)


import sys, math, queue, bisect
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 = 2 * int(input())
num = list((int(num) for num in input().strip().split()))[:n]
num.sort()
if num[n - 1] == num[0]:
	print(-1)
else:
	print(*num)


def solve():
	n = int(input())
	numbers = sorted([int(x) for x in input().split()])
	if sum(numbers[:n]) == sum(numbers[n:]):
		print(-1)
		return
	else:
		print(*numbers)
		return
solve()


n = int(input())
a = map(int, input().split())
a = sorted(a)
b = []
for i in range(n):
	b.append(a[0])
	a.pop(0)
if sum(a) != sum(b):
	for i in range(len(a)):
		b.append(a[i])
	for i in range(len(b)):
		print(b[i], end=' ')
else:
	print(-1)


n = int(input())
arr = list(map(int, input().split()))
b = -1
arr.sort()
for q in arr:
	if q != arr[0]:
		b = q
		break
if b == -1:
	print(-1)
else:
	for q in arr:
		print(q, end=' ')
	print('')


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())
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()))
s1 = 0
for i in range(n):
	s1 += a[i]
s2 = 0
for i in range(n, 2 * n):
	s2 += a[i]
if s1 != s2:
	print(*a, sep=' ')
else:
	d1 = dict()
	for i in range(n):
		d1[a[i]] = i
	d2 = dict()
	for i in range(n, 2 * n):
		d2[a[i]] = i
	if len(d1) > len(d2):
		(d1, d2) = (d2, d1)
	x = list(d1.keys())[0]
	if x in d2:
		del d2[x]
	if d2:
		y = list(d2.keys())[0]
		i = d1[x]
		j = d2[y]
		(a[i], a[j]) = (a[j], a[i])
		print(*a, sep=' ')
	else:
		print(-1)


input()
l = [*map(int, input().split())]
l.sort()
if l[0] == l[-1]:
	print(-1)
else:
	print(*l)


n = int(input())
a = list(map(int, input().split()))
for i in a:
	if i != a[0]:
		break
else:
	print(-1)
	exit()
s1 = sum(a[:n])
s2 = sum(a[n:])
if s1 != s2:
	print(*a)
else:
	for i in range(n):
		for j in range(n, 2 * n):
			if a[i] != a[j]:
				(a[i], a[j]) = (a[j], a[i])
				print(*a)
				exit()


n = int(input())
aa = list(map(int, input().split()))
aa.sort()
if aa[0] == aa[-1]:
	print(-1)
else:
	print(' '.join(map(str, aa)))


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


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


t = int(input())
l = list(map(int, input().split()))
p = list(l)
p.sort(reverse=True)
my_set = []
use = [0] * 2 * t
for i in range(t):
	my_set.append(p[i])
for i in range(t):
	e = my_set[i]
	for j in range(2 * t):
		if e == l[j]:
			if use[j] == 1:
				continue
			else:
				use[j] = 1
				break
mp = []
ps = []
for i in range(2 * t):
	if use[i] == 1:
		mp.append(l[i])
	if use[i] == 0:
		ps.append(l[i])
if sum(mp) == sum(ps):
	print(-1)
else:
	print(*mp + ps)


n = int(input())
m = list(map(int, input().split()))
m.sort()
sum1n = 0
sum2n = 0
for i in range(0, n):
	sum1n += m[i]
for i in range(n, 2 * n):
	sum2n += m[i]
if sum1n != sum2n:
	for i in range(0, 2 * n):
		print(m[i], end=' ')
else:
	print(-1)


import sys
input = sys.stdin.readline
n = int(input())
a = list(sorted(list(map(int, input().split()))))
if sum(a[:n]) != sum(a[n:]):
	for i in a:
		print(i, end=' ')
else:
	print(-1)


def inp_n():
	return int(input())

def inp_list():
	return list(map(int, input().split()))

def inp_mul_num():
	return map(int, input().split())

def is_odd(n):
	if n & 1:
		return True
	return False
from collections import defaultdict
n = inp_n()
l = inp_list()
l.sort()
if l[0] == l[-1]:
	print(-1)
else:
	print(*l)


def call(n, a, flag, x, y):
	for i in range(n):
		for j in range(n, 2 * n):
			if x - a[i] + a[j] != y + a[i] - a[j]:
				(a[i], a[j]) = (a[j], a[i])
				for val in a:
					print(val, end=' ')
				print()
				flag = True
				return
	if flag == False:
		print(-1)
n = int(input())
a = list(map(int, input().split()))
x = sum(a[0:n])
y = sum(a[n:2 * n])
flag = False
if x != y:
	for val in a:
		print(val, end=' ')
	print()
	flag = True
else:
	call(n, a, flag, x, y)


n = int(input())
a = map(int, input().split())
a = sorted(a)
k1 = 0
k2 = 0
for i in range(n):
	k1 += a[i]
for i in range(n, 2 * n):
	k2 += a[i]
if k2 == k1:
	print('-1')
else:
	for i in range(2 * n):
		print(a[i], end=' ')


n = int(input())
a = [int(o) for o in input().split()]
if len(list(set(a))) == 1:
	print(-1)
else:
	a = sorted(a)
	print(*a)


n = int(input())
s = sorted(list(map(int, input().split())))
if sum(s[:n]) != sum(s[n:2 * n]):
	for i in s:
		print(i, end=' ')
else:
	print(-1)


n = int(input())
x = list(map(int, input().split()))
flag = 0
for i in range(0, 2 * n - 1):
	if x[i] != x[i + 1]:
		flag = 1
		break
if flag:
	x = sorted(x)
	for i in x:
		print(i, end=' ')
else:
	print(-1)


n = int(input())
lst = list(map(int, input().split()))
if len(set(lst)) == 1:
	print(-1)
else:
	lst.sort()
	for i in lst:
		print(i, end=' ')


n = int(input())
a = [str(i) for i in input().split(' ')]
dif = []
for i in range(2 * n):
	if a[i] not in dif:
		dif.append(a[i])
if len(dif) == 1:
	print(-1)
else:
	print(' '.join(sorted(a)))


def main():
	l = int(input())
	numbers = list(map(int, input().split()))
	numbers.sort()
	if sum(numbers[:l]) == sum(numbers[l:]):
		print(-1)
	else:
		for x in numbers:
			print('{} '.format(x), end='')
main()


n = int(input())
t = list(map(int, input().split()))
t.sort()
if sum(t[:n]) != sum(t[n:]):
	print(*t)
elif len(set(t)) == 1:
	print(-1)
else:
	for j in range(2 * n):
		t = t[-j:] + t[:-j]
		if sum(t[:n]) != sum(t[:n]):
			print(*t)
			h += 1
			break
	if h == 0:
		print(-1)


from sys import stdin
import math
from collections import defaultdict
import bisect
I = stdin.readline
n = int(I())
n = 2 * n
arr = [int(x) for x in I().split()]
arr.sort()
suma = sum(arr)
sumb = 0
for i in range(n // 2):
	sumb += arr[i]
if 2 * sumb != suma:
	for i in arr:
		print(i, end=' ')
else:
	print(-1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
l = list(map(int, input().split()))
l.sort()
if l[0] == l[2 * n - 1]:
	print(-1)
else:
	print(*l, sep=' ')


length = int(input())
a = list(map(int, input().split()))
a = sorted(a)
sum1 = 0
sum2 = 0
for i in range(length):
	sum1 += a[i]
for i in range(length):
	sum2 += a[i + length]
if sum1 == sum2:
	print(-1)
else:
	for k in a:
		print(k, end=' ')


N = int(input())
sk = [int(x) for x in input().split()]
sk.sort()
if 2 * sum(sk[:N]) == sum(sk):
	print(-1)
else:
	for u in sk:
		print(u, end=' ')


n = int(input()) * 2
a = map(int, input().split()[:n])
a = list(a)
k = 0
q = []
w = []
for i in range(n // 2):
	q.append(int(a[i]))
	w.append(int(a[i + n // 2]))
for i in range(n // 2):
	for b in range(n // 2):
		if q[i] != w[b]:
			(q[i], w[b]) = (w[b], q[i])
			if sum(q) != sum(w):
				k += 1
				break
	if k == 1:
		break
if q == w:
	print(-1)
else:
	print(*q, *w)


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


n = int(input())
a = input().split()
a.sort()
for i in range(1, 2 * n):
	if a[i - 1] != a[i]:
		for each in a:
			print(each, end=' ')
		exit()
print(-1)


import sys
import math
import collections
import heapq
input = sys.stdin.readline
n = int(input())
l = sorted([int(i) for i in input().split()])
if len(set(l)) == 1:
	print(-1)
else:
	print(*l)


n = int(input())
a = [int(x) for x in input().split()]
l = len(a) / 2
if len(set(a)) == 1:
	print('-1')
else:
	a = sorted(a)
a1 = a[:n]
a2 = a[n:]
if sum(a1) != sum(a2):
	print(*a1 + a2, sep=' ')


n = 2 * int(input())
a = sorted([*map(int, input().split())])
if a[0] == a[-1]:
	print(-1)
else:
	for e in a:
		print(e, end=' ')


n = int(input())
d = [int(i) for i in input().split()]
a = set(d)
if len(a) > 1:
	print(' '.join([str(i) for i in sorted(d)]))
else:
	print(-1)


n = int(input())
p = list((int(a) for a in input().split()))
p.sort()
if p[0] == p[2 * n - 1]:
	print(-1)
else:
	for i in p:
		print(i, end=' ')
	print()


n = int(input())
a = list(map(int, input().split()))
a.sort()
f = False
for i in range(2 * n - 1):
	if a[i] != a[i + 1]:
		f = True
		break
if f:
	print(*a, sep=' ')
else:
	print(-1)


k = int(input())
a = list(map(int, input().split(' ')))
a.sort()
a1 = a[0:k]
a2 = a[k:]
ans = '-1'
if sum(a1) != sum(a2):
	print(' '.join(map(str, a)))
else:
	print('-1')


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


input()
a = (*sorted(map(int, input().split())),)
print(*[[*a], [-1]][a[0] == a[-1]])


a = int(input())
x = input().split()
y = set(x)
if len(y) == 1:
	print('-1')
else:
	x.sort()
	x = ' '.join(x)
	print(x)


n = int(input())
l = list(map(int, input().split()))
l.sort()
if len(list(set(l))) == 1:
	print(-1)
else:
	while sum(l[:n]) == sum(l[n:]):
		r = min(l[:n])
		p = max(l[n:])
		a = l.index(min(l[:n]))
		b = l.index(max(l[n:]))
		temp = a
		a = b
		b = temp
		l[a] = r
		l[b] = p
	print(*l)


n = map(int, input())
a = map(int, input().split())
a = sorted(a)
if a[0] == a[len(a) - 1]:
	print(-1)
else:
	print(' '.join([str(x) for x in a]))


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


n = int(input())
a = [int(a) for a in input().split()]
a.sort()
suml = 0
sumr = 0
for i in range(0, n):
	suml += a[i]
	sumr += a[2 * n - 1 - i]
if suml == sumr:
	print(-1)
else:
	for i in range(0, 2 * n):
		print(a[i], end=' ')


n = int(input())
A = sorted([int(i) for i in input().split()])
if sum(A[:n]) != sum(A[n:]):
	for i in range(2 * n):
		A[i] = str(A[i])
	print(' '.join(A))
else:
	print('-1')


n = int(input())
n = 2 * n
l = sorted(list(map(int, input().split())))
p = sum(l[:n // 1 - 1])
f = sum(l)
k = f - p
if k != p and l[0] != l[-1]:
	print(' '.join((str(i) for i in l)))
else:
	print(-1)


from collections import Counter, defaultdict
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
n = I()
a = LI()
a.sort()
b = sum(a[0:n])
c = sum(a[n:])
if b != c:
	print(*a)
else:
	print(-1)


def main():
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	if arr[0] == arr[-1]:
		print(-1)
		return
	print(*arr)
main()


n = int(input())
q = [int(i) for i in input().split()]
if len(set(q)) > 1:
	print(' '.join([str(i) for i in sorted(q)]))
else:
	print(-1)


n = int(input())
arr = [int(x) for x in input().strip().split()]

def f(arr):
	if sum(arr) % 2 != 0:
		return arr
	else:
		arr1 = arr[:]
		arr.sort()
		if arr[0] == arr[-1]:
			return -1
		if sum(arr[:len(arr) // 2]) == sum(arr[len(arr) // 2:]):
			return arr
		return arr
a = f(arr)
if a == -1:
	print(-1)
else:
	for x in a:
		print(x, end=' ')


input()
list = sorted(map(int, input().split()))
sum = 0
for i in range(0, len(list) // 2):
	sum = sum + list[i]
sum2 = 0
for i in range(len(list) // 2, len(list)):
	sum2 = sum2 + list[i]
if sum == sum2:
	print(-1)
else:
	print(*list, sep=' ')


import math
from decimal import Decimal

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def ist(x):
	d = 1
	while d < x:
		d *= 2
	return d == x
n = int(input()) * 2
a = list(map(int, input().split()))
if len(set(a)) == 1:
	print(-1)
	exit()
else:
	print(*sorted(a))


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


n = int(input())
a = list(map(int, input().split()))
a.sort()
cnt = 0
for i in range(n):
	cnt += a[i]
if cnt != sum(a) - cnt:
	print(*a)
else:
	print(-1)


import sys, math

def read_int():
	return int(sys.stdin.readline().strip())

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

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

def read_string_list(delim=' '):
	return sys.stdin.readline().strip().split(delim)
n = read_int()
arr = read_int_list()
arr.sort()
if sum(arr[:n]) == sum(arr[n:]):
	print(-1)
else:
	print(' '.join(map(str, arr)))


n = int(input())
a = list(map(int, input().split()))
a.sort()
if len(list(set(a))) == 1:
	print(-1)
else:
	for x in a:
		print(x, end=' ')
	print()


n = int(input())
a = list(map(int, input().split()))
ans = sorted(a)
x = sum(a)
y = 0
for i in range(0, n):
	y += ans[i]
if 2 * y == x:
	print(-1)
else:
	for i in ans:
		print(i, end=' ')


def ton(x, num):
	num = sorted(num)
	num1 = num[:len(num) // 2]
	num2 = num[len(num) // 2:]
	if sum(num1) == sum(num2):
		print('-1')
	else:
		print(*num1, end=' ')
		print(*num2)
x = int(input())
num = [int(x1) for x1 in input().split(' ')]
ton(x, num)


n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = False
for i in range(1, 2 * n):
	if a[i] != a[i - 1]:
		flag = True
		break
if flag:
	for i in a:
		print(i, end=' ')
else:
	print('-1')


import sys

def valid(lst, n):
	sum1 = 0
	sum2 = 0
	for i in range(n):
		sum1 += lst[i]
		sum2 += lst[n + i]
	return sum1 != sum2

def printlist(lst):
	for i in range(len(lst)):
		sys.stdout.write(str(lst[i]))
		if i != len(lst) - 1:
			sys.stdout.write(' ')
n = int(input())
lst = [int(x) for x in input().split()]
if valid(sorted(lst), n):
	printlist(sorted(lst))
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=' ')


import sys

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

def get_ints():
	return 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)
main()


n = int(input())
a = list(map(int, input().split()))
if sum(a[0:n]) != sum(a[n:2 * n]):
	print(*a)
else:
	for i in range(n):
		for j in range(i + n, 2 * n):
			if a[i] != a[j]:
				(a[i], a[j]) = (a[j], a[i])
				print(*a)
				quit()
	print(-1)


import os, sys, shutil, glob, re
import time, calendar
from datetime import datetime, timezone
import hashlib, zipfile, zlib
from math import *
from operator import itemgetter
from functools import wraps, cmp_to_key, reduce, lru_cache
from itertools import count, combinations, permutations
from collections import namedtuple, defaultdict, Counter, deque
from queue import Queue
from bisect import bisect_left, bisect_right

class CustomException(Exception):
	pass
if os.getenv('SJDEAK'):
	debug = print
else:
	debug = lambda *args, **kwargs: None
N = int(input())
A = sorted(list(map(int, input().split())))
if sum(A[:N]) == sum(A[N:]):
	print(-1)
else:
	print(*A)


n = int(input())
l = sorted([int(x) for x in input().split()])
if len(set(l)) == 1:
	print(-1)
else:
	print(*l)


n = int(input())
a = [int(x) for x in input().split()]
isTrue = True
first = a[0]
for z in a:
	if z != first:
		isTrue = False
		break
if isTrue:
	print(-1)
elif sum(a[:n]) == sum(a[n:]):
	end = a[-1]
	for i in range(n):
		if a[i] != end:
			this = a[i]
			a[i] = end
			a[-1] = this
			print(*a)
			break
else:
	print(*a[n:] + a[:n])


n = int(input())
z = [int(i) for i in input().split()]
z2 = list(z)
z2.sort()
if len(set(z2)) == 1:
	print(-1)
else:
	print(*z2)


a = int(input())
arr = list(map(str, input().split(' ')))
first = sum([int(arr[i]) for i in range(0, a)])
second = sum([int(arr[i]) for i in range(a, 2 * a)])
if first != second:
	print(' '.join(arr))
else:
	arr.sort()
	first = sum([int(arr[i]) for i in range(0, a)])
	second = sum([int(arr[i]) for i in range(a, 2 * a)])
	if first == second:
		print('-1')
	else:
		print(' '.join(arr))


n = int(input())
nums = list(map(int, input().split()))
nums.sort()
solution = True
f = sum([a for a in nums[:n]])
s = sum([a for a in nums[n:]])
if s == f:
	print(-1)
else:
	ans = ''
	for n in nums:
		ans += str(n) + ' '
	print(ans)


n = int(input())
vct = list(map(int, input().split()))
vct.sort()
s1 = 0
s2 = 0
for i in range(0, n, 1):
	s1 = s1 + vct[i]
for i in range(n, 2 * n, 1):
	s2 = s2 + vct[i]
if s1 == s2:
	print(-1)
else:
	for i in range(0, 2 * n, 1):
		print(vct[i], end=' ')


n = int(input())
t = list(map(int, input().split()))
t_sort = sorted(t)
if t_sort[0] == t_sort[-1]:
	print('-1')
else:
	print(' '.join((str(z) for z in t_sort)))


n = int(input())
z = list(map(int, input().split()))
z.sort()
kiri = 0
kanan = 0
for i in range(n):
	kiri += z[i]
	kanan += z[i + n]
if kiri == kanan:
	print(-1)
else:
	for i in range(n * 2):
		if i == n * 2 - 1:
			print(z[i])
		else:
			print(z[i], end=' ')


n = int(input())
l = [int(x) for x in input().split()]
first = l[0]
flag = False
for i in range(2 * n):
	if first != l[i]:
		flag = True
if flag:
	l.sort()
	s = ' '.join((str(x) for x in l))
	print(s)
else:
	print('-1')


import sys
import math
import bisect

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


n = int(input())
lis = sorted(map(int, input().split()))
if sum(lis[:n]) == sum(lis[n:]):
	print('-1')
else:
	print(*lis)


def check_all_elements_same(l):
	for i in range(len(l) - 1):
		if l[i] != l[i + 1]:
			return False
	return True
n = int(input())
l = list(map(int, input().split()))
if check_all_elements_same(l):
	print(-1)
else:
	l.sort()
	print(*l)


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


n = int(input())
A = [int(x) for x in input().split()]
if len(set(A)) == 1:
	print(-1)
else:
	print(*sorted(A), sep=' ')


n = int(input())
arr = sorted([int(x) for x in input().split()])
if sum(arr[:n]) == sum(arr[n:]):
	print('-1')
else:
	print(str(arr).replace(',', '').replace('[', '').replace(']', ''))


def read_ints():
	return map(int, input().split())

def read_array():
	return list(read_ints())

def main():
	n = int(input())
	arr = read_array()
	arr.sort()
	s1 = sum(arr[:n])
	s2 = sum(arr[n:])
	if s1 != s2:
		print(' '.join(map(str, arr)))
	else:
		print('-1')
main()


n = int(input())
a = list(map(int, input().split()))
a.sort()
(ans, ans1) = (0, 0)
for i in a[:n]:
	ans += i
for i in a[n:]:
	ans1 += i
if ans == ans1:
	print(-1)
else:
	print(*a)


n = int(input())
l = list(map(int, input().split()))

def change(l):
	l.sort()
	if sum(l[:n]) != sum(l[n:]):
		return l
	l = [-1]
	return l
k = change(l)
for i in k:
	print(i, end=' ')


import collections as clt
number_of_elements = 0
arr = []

def Input(number_of_elements, arr):
	number_of_elements = int(input())
	number_of_elements *= 2
	arr = list(map(int, input().split()))
	return (number_of_elements, arr)

def Processing(number_of_elements, arr):
	arr.sort()
	if arr[0] == arr[number_of_elements - 1]:
		print('-1')
	else:
		for index in range(number_of_elements):
			print(arr[index], end=' ')
	return (number_of_elements, arr)
(number_of_elements, arr) = Input(number_of_elements, arr)
(number_of_elements, arr) = Processing(number_of_elements, arr)


asd = int(input())
a = input().split()
for i1 in range(len(a)):
	a[i1] = int(a[i1])
m1 = []
m2 = []
sc = 0
for i in range(asd):
	w = int(max(a))
	r = a.index(w)
	m1.append(w)
	del a[r]
	sc += w
	w = min(a)
	r = a.index(w)
	m2.append(w)
	del a[r]
	sc -= w
res = 1
if sc == 0:
	res = 0
if res == 1:
	for o in m1:
		print(o, end=' ')
	for o1 in m2:
		print(o1, end=' ')
else:
	print(-1)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
if sum(arr[:n]) == sum(arr[n:]):
	print(-1)
else:
	for i in range(n * 2):
		print(arr[i], end=' ')
	print()


N = int(input())
a_list = list(map(int, input().split()))
a_set = set(a_list)
if len(a_set) == 1:
	print(-1)
	exit()
a_list.sort()
for a in a_list:
	print(a, end=' ')
print()


def main():
	n = int(input())
	a = [int(x) for x in input().split()]
	k = len(a)
	a1 = sorted(a)
	s1 = a1[:k // 2]
	s2 = a1[k // 2:]
	sum1 = sum(s1)
	sum2 = sum(s2)
	if sum1 == sum2:
		print(-1)
	else:
		for i in range(len(a1)):
			print(a1[i], end=' ')
main()


a = int(input())
S = [int(i) for i in input().split()]
S = sorted(S)
sum1 = sum2 = 0
for i in range(1, a + 1):
	sum1 += S[i - 1]
	sum2 += S[-i]
if sum1 != sum2:
	for i in range(a * 2):
		print(S[i], end=' ')
else:
	print(-1)


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


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


n = int(input())
m = input().split()

def r(x):
	return (len(x), x)
if len(set(m)) == 1:
	print(-1)
else:
	m.sort(key=r)
	print(' '.join(m))


import sys
import math
from functools import reduce
n = int(input())
a = list(map(int, sys.stdin.readline().split()))
flag = False
if sum(a[:n]) != sum(a[n:]):
	flag = True
else:
	for x in range(n):
		for y in range(n, 2 * n):
			if a[x] != a[y]:
				(a[x], a[y]) = (a[y], a[x])
				flag = True
				break
		if flag:
			break
if flag:
	print(' '.join((str(x) for x in a)))
else:
	print(-1)


n = int(input())
x = []
s1 = 0
s2 = 0
x = list(map(int, input().split()))
same = x[0] == x[1]
for i in range(2 * n):
	if same:
		same = x[0] == x[i]
	if i < n:
		s1 += x[i]
	else:
		s2 += x[i]
if s1 != s2:
	for i in x:
		print(i, end=' ')
elif same:
	print(-1)
else:
	for i in range(n):
		if x[i] != x[-1]:
			(x[i], x[-1]) = (x[-1], x[i])
			break
	for i in x:
		print(i, end=' ')


n = int(input())
l = list(map(int, input().strip().split()))
l = sorted(l)
if sum(l[:n]) != sum(l[n:]):
	print(*l)
else:
	print('-1')


n = int(input())
a = list(map(int, input().split()))
a_1 = a[0:n]
a_2 = a[n:2 * n]
if sum(a_1) != sum(a_2):
	for item in a:
		print(item, end=' ')
elif max(a_1) == min(a_1) and max(a_2) == min(a_2):
	print('-1')
else:
	flag = 0
	for i in range(0, len(a_1)):
		for j in range(0, len(a_2)):
			if a_1[i] != a_2[j]:
				temp = a_1[i]
				a_1[i] = a_2[j]
				a_2[j] = temp
				flag = 1
				break
		if flag == 1:
			break
	for item in a_1:
		print(item, end=' ')
	for item in a_2:
		print(item, end=' ')


(x, p) = (int(input()), sorted(map(int, input().split())))
if sum(p[:x]) != sum(p[x:]):
	print(*p[0:x], *p[x:])
else:
	print(-1)


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
sum1 = 0
sum2 = 0
for i in range(n):
	sum1 += lst[i]
for i in range(n, 2 * n):
	sum2 += lst[i]
if sum1 == sum2:
	print(-1)
else:
	print(' '.join([str(e) for e in lst]))


def main():
	n = int(input()) * 2
	numbers = list(map(int, input().split()))
	numbers.sort()
	if numbers[0] == numbers[n - 1]:
		print('-1')
	else:
		print(' '.join([str(value) for value in numbers]))
main()


num1 = []
sum = 0
total = 0
n = int(input())
num1 = [int(x) for x in input().split()]
for i in range(0, 2 * n):
	sum += num1[i]
num1.sort()
for i in range(0, n):
	total += num1[i]
if total != sum / 2:
	for i in num1:
		print(i, end=' ')
else:
	print('-1')


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


import sys
sys.setrecursionlimit(10 ** 6)

def main():
	(n, *a) = map(int, open(0).read().split())
	a.sort()
	c = a[:n]
	d = a[n:]
	if sum(c) == sum(d):
		print(-1)
	else:
		print(*a)
main()


x = int(input())
li = list(map(int, input().split()))
ab = list(set(li)) * 2
li.sort()
ab.sort()
if 1 == 1:
	x = x
if 5 == 5:
	x = x
if len(ab) == 2:
	print(-1)
	exit(0)
else:
	print(' '.join((str(i) for i in li)))


n = int(input())
a = list(map(int, input().split()))
is_equal1 = True
id1 = -1
is_equal2 = True
id2 = -1
for i in range(n - 1):
	if a[i] != a[i + 1]:
		is_equal1 = False
		break
for i in range(n - 1):
	if a[i + n] != a[i + n + 1]:
		is_equal2 = False
		break
is_equal = is_equal1 and is_equal2 and (a[0] == a[n])
if is_equal:
	print(-1)
else:
	if sum(a[:n]) == sum(a[n:]):
		if is_equal1 and is_equal2:
			(a[0], a[n]) = (a[n], a[0])
		elif is_equal2:
			for i in range(n):
				if a[i] != a[n]:
					(a[i], a[n]) = (a[n], a[i])
					break
		else:
			for i in range(n):
				if a[i + n] != a[0]:
					(a[i + n], a[0]) = (a[0], a[i + n])
					break
	for i in a:
		print(i, end=' ')


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


n = input()
arr = input().split()
foo = all((elem == arr[0] for elem in arr))
arr.sort()
if foo:
	print('-1')
else:
	print(' '.join(arr))


import os
import operator
import sys
import bisect
import _operator
from _collections import defaultdict
from io import BytesIO, IOBase

def inar():
	return [int(k) for k in input().split()]

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def main():
	n = int(input())
	arr = inar()
	counter = 0
	for i in range(1, 2 * n):
		if arr[i] != arr[0]:
			counter = 1
			break
	if counter:
		arr.sort(reverse=True)
		print(*arr)
	else:
		print(-1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
numbers = list(map(int, input().split(' ')))
sorted_numbers = sorted(numbers)
if sum(sorted_numbers[:n]) == sum(sorted_numbers[n:]):
	print('-1')
else:
	print(*sorted_numbers, sep=' ')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	val = a[0]
	flag = 0
	for i in range(1, len(a)):
		if a[i] != val:
			flag = 1
	if flag:
		a.sort()
		for x in a:
			print(x, end=' ')
	else:
		print(-1)
solve()


n = int(input())
n = n * 2
l = list(map(int, input().split()))
s = set()
for i in l:
	s.add(i)
if len(s) == 1:
	print(-1)
else:
	l.sort()
	print(*l)


a = int(input())
s = [int(x) for x in input().split()]
s.sort()
if sum(s[:a]) == sum(s[a:]):
	print(-1)
else:
	for i in s:
		print(i, end=' ')


n = int(input())
lis = list(map(int, input().split()))
lis.sort()
if sum(lis[:n]) == sum(lis[n:]):
	print(-1)
else:
	for i in lis:
		print(i, end=' ')
	print()


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from heapq import heapify, heappop, heappush
n = int(input())
l = list(map(int, input().split()))
if len(set(l)) == 1:
	print(-1)
else:
	print(*sorted(l))


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


n = int(input())
l = list(map(int, input().split()))
l1 = l.copy()
l1.sort()
if l1 == l:
	if sum(l[0:len(l) // 2]) != sum(l[len(l) // 2:len(l)]):
		print(*l)
	else:
		print(-1)
else:
	print(*l1)


q = int(input())
n = input().split()
if len(set(n)) == 1:
	print(-1)
else:
	print(*sorted(n))


n = int(input())
arr = list(map(int, input().split()))
n = 2 * n
s = sum(arr)
arr.sort()
if arr[0] == arr[n - 1]:
	print('-1')
elif arr[0] != arr[n - 1]:
	i = 0
	while i < n:
		print(arr[i], end=' ')
		i += 1


def partiiton(a):
	n = len(a)
	a.sort()
	first_hlf = a[:n // 2]
	second_hlf = a[n // 2:]
	if sum(first_hlf) != sum(second_hlf):
		return ' '.join([str(i) for i in a])
	return -1
n = int(input())
a = list(map(int, input().split()))
print(partiiton(a))


n = int(input())
a = [int(i) for i in filter(None, input().split(' '))]
first = [0] * n
second = [0] * n * 2
for i in range(0, n):
	first[i] = a[i]
	second[i + n] = a[i + n]
if sum(first) == sum(second):
	first_min_index = first.index(min(first))
	second_max_index = second.index(max(second))
	b = first[first_min_index]
	first[first_min_index] = second[second_max_index]
	second[second_max_index] = b
if sum(first) == sum(second):
	print(-1)
else:
	for i in range(0, n):
		a[i] = first[i]
		a[i + n] = second[i + n]
	print(' '.join(map(str, a)))


n = int(input())
if n <= 0 or n > 1000:
	print(-1)
strList = input()
nums = [int(num) for num in strList.split(' ')]
nums.sort()
if nums[:n] == nums[n:]:
	(nums[-1], nums[0]) = (nums[0], nums[-1])
	if nums[:n] == nums[n:]:
		print(-1)
	else:
		print(' '.join([str(s) for s in nums]))
else:
	print(' '.join([str(s) for s in nums]))


def main():
	buf = input()
	n = int(buf)
	buf = input()
	buflist = buf.split()
	a = list(map(int, buflist))
	a.sort()
	top_sum = 0
	bottom_sum = 0
	for (i, x) in enumerate(a):
		if i < n:
			top_sum += x
		else:
			bottom_sum += x
	if top_sum == bottom_sum:
		print(-1)
	else:
		print(' '.join(list(map(str, a))))
main()


n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = 0
for i in range(n):
	if sum(a[i:n + i]) != sum(a[n + i:]) + sum(a[:i]):
		flag = 1
		break
if flag == 0:
	print(-1)
else:
	for j in range(i, 2 * n):
		print(a[j], end=' ')
	for k in range(i):
		print(a[k], end=' ')


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


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, OrderedDict
import math
import heapq

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
n = intIn()
a = listIn()
a.sort()
if sum(a[:n]) != sum(a[n:]):
	print(*a)
else:
	print(-1)


N = int(input())
Arr = list(map(int, input().split()))
from itertools import combinations
ans = -1
Arr.sort()
if Arr[:N] == Arr[N:]:
	print(-1)
else:
	for comb in combinations(range(2 * N), r=N):
		temp_a = 0
		temp_b = 0
		for idx in range(2 * N):
			if idx in comb:
				temp_a += Arr[idx]
			else:
				temp_b += Arr[idx]
		if temp_a != temp_b:
			ans = comb
			break
	if ans == -1:
		print(ans)
	else:
		for idx in ans:
			print(Arr[idx], end=' ')
		for _ in range(2 * N):
			if _ not in ans:
				print(Arr[_], end=' ')


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


N = int(input())
A = map(int, input().split())
A = sorted(A)
x = sum(A[:N])
y = sum(A[N:])
if x == y:
	print(-1)
else:
	print(' '.join(map(str, A)))


x = int(input())
l = input().split()
for i in range(x + x):
	l[i] = int(l[i])
can = False
for i in range(1, x + x):
	if l[i] != l[0]:
		can = True
if not can:
	print(-1)
	exit(0)
(sum1, sum2) = (0, 0)
for i in l[:x]:
	sum1 += i
for i in l[x:]:
	sum2 += i
fl = False
if sum1 == sum2:
	for i in range(x):
		for j in range(x, x + x):
			if l[i] != l[j]:
				(l[i], l[j]) = (l[j], l[i])
				fl = True
				break
			if fl:
				break
		if fl:
			break
o = []
for i in l:
	o.append(str(i))
print(' '.join(o))


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
import itertools

def Int():
	return int(sys.stdin.readline())

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

def Lstr():
	return list(sys.stdin.readline().strip())

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

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

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

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	n = Int()
	a = List()
	a.sort()
	if sum(a[0:n]) != sum(a[n:2 * n]):
		print(*a)
	else:
		print(-1)
solution()


n = int(input())
ar = list(map(int, input().split()))
ar.sort()
if ar[0] == ar[-1]:
	print(-1)
else:
	for i in range(2 * n):
		print(ar[i], end=' ')


n = int(input())
l = list(map(int, input().split()))
if min(l) == max(l):
	print('-1')
else:
	l.sort()
	for i in l:
		print(i, end=' ')


n = int(input())
a = [int(i) for i in input().split()]
first = sum(a[:n])
second = sum(a[n:])
if first == second:
	f = False
	for i in range(n):
		if f:
			break
		for j in range(n, 2 * n):
			if first - a[i] + a[j] != second + a[i] - a[j]:
				f = True
				(a[i], a[j]) = (a[j], a[i])
				break
	if not f:
		print(-1)
	else:
		print(*a)
else:
	print(*a)


from sys import stdin, stdout
n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
arr.sort()
ar = list(set(arr))
s1 = sum(arr[:n])
s2 = sum(arr[n:])
if s1 == s2:
	stdout.write('-1\n')
else:
	for i in arr:
		stdout.write(str(i) + ' ')


n = int(input())
a = [int(i) for i in input().split()]
result = [-1]
a = sorted(a)
if sum(a[:n]) != sum(a[n:]):
	result = a
print(' '.join(map(str, result)))


t = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
n = len(arr)
if sum(arr[:n // 2]) != sum(arr[n // 2:]):
	print(*arr)
else:
	print(-1)


from collections import Counter
gi = lambda : list(map(int, input().strip().split()))
(n,) = gi()
l = gi()
l.sort()
if sum(l[:n]) == sum(l[n:]):
	print(-1)
else:
	print(' '.join(map(str, l)))


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
s1 = sum(a[0:n])
s2 = sum(a) - s1
if s1 == s2:
	print(-1)
else:
	print(' '.join((str(i) for i in a)))


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


n = eval(input())
a = list(map(int, input().split()))
a.sort()
sum1 = 0
sum2 = 0
for i in range(2 * n):
	if i < n:
		sum1 += a[i]
	else:
		sum2 += a[i]
if sum1 == sum2:
	print('-1')
else:
	for x in a:
		print(x, end=' ')
	print('')


from sys import stdin, stdout
from collections import Counter

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

def ei():
	return map(int, stdin.readline().split())

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
n = ip()
li = ai()
if len(set(li)) > 1:
	print(*sorted(li))
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
sum = 0
for i in range(0, n, 1):
	sum += a[i]
ans = 0
for i in range(n, 2 * n, 1):
	ans += a[i]
if ans == sum:
	print('-1')
else:
	for i in range(len(a)):
		print(str(a[i]) + ' ', end='')


n = int(input())
l = sorted(map(int, input().split()))
print(*([-1], l)[len(set(l)) != 1])


n = int(input())
arr = input().split()
l1 = []
l2 = []
sum1 = 0
sum2 = 0
s = ''
for i in range(n):
	s += arr[i] + ' '
	l1.append(int(arr[i]))
	sum1 += int(arr[i])
for i in range(n, 2 * n):
	s += arr[i] + ' '
	l2.append(int(arr[i]))
	sum2 += int(arr[i])
if sum1 != sum2:
	print(s)
else:
	result = False
	for i in range(n):
		for j in range(n):
			if l1[i] != l2[j]:
				(l1[i], l2[j]) = (l2[j], l1[i])
				result = True
				break
		if result:
			result = True
			break
	if not result:
		print('-1')
	else:
		s = ''
		for i in range(n):
			s += str(l1[i]) + ' '
		for i in range(n):
			s += str(l2[i]) + ' '
		print(s)


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


a = int(input())
b = list(map(int, input().split()))
c = set(b)
if len(c) == 1:
	print('-1')
else:
	b.sort()
	for elem in b:
		print(elem, end=' ')


def rearrange(array):
	num_el = int(len(array) / 2)
	array.sort()
	s1 = sum(array[0:num_el])
	s2 = sum(array[num_el:])
	if s1 == s2:
		return [-1]
	return array
nd = input().split()
n = int(nd[0])
a = list(map(int, input().rstrip().split()))
result = rearrange(a)
print(' '.join(map(str, result)))


n = int(input())
a = list(map(int, input().split(' ')))
set_a = list(set(a))
if len(list(set(a))) == 1:
	print('-1')
	exit()
a.sort()
print(*a)


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


import collections
n = int(input())
a = [int(i) for i in input().split()]
d = collections.Counter(a)
flag = 0
for i in a:
	if d[i] == 2 * n:
		flag = -1
		break
if flag == -1:
	print('-1')
else:
	a.sort()
	print(*a, sep=' ')


from collections import deque
N = int(input())
A = [int(x) for x in input().split()]
A = sorted(A)
if sum(A[0:N]) != sum(A[N:]):
	for i in range(2 * N):
		print(A[i], end=' ')
	print()
else:
	print(-1)


def f():
	N = int(input())
	l = [int(i) for i in input().split(' ')]
	if len(set(l)) == 1:
		print(-1, end=' ')
		return
	s = sum(l)
	s1 = sum(l[:N])
	if s1 * 2 != s:
		for i in l:
			print(i, end=' ')
		return
	else:
		for i in range(N, 2 * N):
			for j in range(0, N):
				if l[i] != l[j]:
					(l[i], l[j]) = (l[j], l[i])
					for i in l:
						print(i, end=' ')
					return
f()


def solve(A, n):
	A.sort()
	same = True
	for i in range(1, len(A)):
		if A[i] != A[i - 1]:
			same = False
	if same:
		return ['-1']
	return A
n = int(input())
A = [int(n) for n in input().split()]
res = solve(A, n)
res = [str(n) for n in res]
print(' '.join(res))


n = int(input())
y = list(map(int, input().split()))
(a, b) = (0, 0)
for x in range(n):
	a += y[x]
	b += y[x + n]
c = y.count(y[0])
if c == len(y):
	print(-1)
elif a != b:
	for x in y:
		print(x, end=' ')
else:
	y.sort()
	for x in y:
		print(x, end=' ')


n = int(input())
a = list(map(int, input().split()))
t = 0
s = 0
x = list(set(a))
for i in range(n):
	s = s + a[i]
c = a.copy()
c.reverse()
for i in range(n):
	t = t + c[i]
a.sort()
if s != t:
	print(*a)
elif len(x) == 1:
	print(-1)
else:
	print(*a)


n = int(input())
k = list(map(int, input().split(' ')))
if len(set(k)) == 1:
	print(-1)
else:
	k.sort()
	print(*k, sep=' ')


n = int(input())
a = list(map(int, input().split()))
if sum(a[:n]) != sum(a[n:]):
	print(*a)
elif len(set(a)) != 1:
	s1 = set(a[:n])
	s2 = set(a[n:])
	if len(s2) == 1:
		x = s2.pop()
		i = a[n:].index(x) + n
		y = s1.pop()
		if x == y:
			y = s1.pop()
		j = a.index(y)
		(a[i], a[j]) = (a[j], a[i])
	else:
		x = s1.pop()
		i = a.index(x)
		y = s2.pop()
		if x == y:
			y = s2.pop()
		j = a[n:].index(y) + n
		(a[i], a[j]) = (a[j], a[i])
	print(*a)
else:
	print(-1)


n = int(input())
nums = list(map(int, input().split()))
first = sum(nums[:n])
last = sum(nums[-n:])
if first != last:
	print(*nums)
	quit()
for i in range(n):
	for j in range(2 * n - 1, 2 * n - n, -1):
		if nums[i] != nums[j]:
			tmp = nums[i]
			nums[i] = nums[j]
			nums[j] = tmp
			first = sum(nums[:n])
			last = sum(nums[-n:])
			if first != last:
				print(*nums)
				quit()
			else:
				tmp = nums[j]
				nums[j] = nums[i]
				nums[i] = tmp
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
flag = 0
for i in range(2 * n - 1):
	if a[i] != a[i + 1]:
		flag = 1
		a.sort()
		for i in a:
			print(i, end=' ')
		break
if flag == 0:
	print(-1)


from collections import Counter
N = int(input())
List = [int(x) for x in input().split()]
Dict = Counter(List)
if len(Dict.keys()) == 1:
	print(-1)
else:
	print(*sorted(List))


n = int(input())
L = [int(x) for x in input().split()]
L.sort()
if L[0] == L[-1]:
	print(-1)
else:
	for x in L:
		print(x, end=' ')


size = int(input())
array = list(map(int, input().split()))
array.sort()
if len(set(array)) == 1:
	print(-1)
else:
	print(' '.join([str(i) for i in array]))


n = int(input())
count = 0
l = sorted(list(map(int, input().split())))
for i in range(2 * n):
	if l[i] == l[0]:
		count += 1
if count == 2 * n:
	print(-1)
else:
	print(' '.join(map(str, l)))


import math
import bisect
import heapq
from collections import defaultdict

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, x, y) = egcd(b % a, a)
		return (g, y - b // a * x, x)

def mulinv(b, n):
	(g, x, _) = egcd(b, n)
	if g == 1:
		return x % n

def isprime(n):
	for d in range(2, int(math.sqrt(n)) + 1):
		if n % d == 0:
			return False
	return True

def argsort(ls):
	return sorted(range(len(ls)), key=ls.__getitem__)

def f(p=0):
	if p == 1:
		return map(int, input().split())
	elif p == 2:
		return list(map(int, input().split()))
	elif p == 3:
		return list(input())
	else:
		return int(input())

class DisjointSet:
	_disjoint_set = list()

	def __init__(self, init_arr):
		self._disjoint_set = []
		if init_arr:
			for item in list(set(init_arr)):
				self._disjoint_set.append([item])

	def _find_index(self, elem):
		for item in self._disjoint_set:
			if elem in item:
				return self._disjoint_set.index(item)
		return None

	def find(self, elem):
		for item in self._disjoint_set:
			if elem in item:
				return self._disjoint_set[self._disjoint_set.index(item)]
		return None

	def union(self, elem1, elem2):
		index_elem1 = self._find_index(elem1)
		index_elem2 = self._find_index(elem2)
		if index_elem1 != index_elem2 and index_elem1 is not None and (index_elem2 is not None):
			self._disjoint_set[index_elem2] = self._disjoint_set[index_elem2] + self._disjoint_set[index_elem1]
			del self._disjoint_set[index_elem1]
		return self._disjoint_set

	def get(self):
		return self._disjoint_set

def graph(n, m, edg=False):
	edges = []
	visited = [0] * n
	g = [list() for _ in range(n + 1)]
	for i in range(m):
		(u, v) = f(1)
		g[u].append(v)
		g[v].append(u)
		if edg:
			edges.append((u, v))
	if edg:
		return (g, visited, edg)
	else:
		return (g, visited)

def bfs(g, visited):
	queue = [1]
	visited[1] = 1
	for u in queue:
		for v in g[u]:
			if visited[v] == 0:
				queue.append(v)
			visited[v] = 1

def dfs(u, g, visited):
	print(u)
	visited[u] = 1
	for v in g[u]:
		if visited[v] == 0:
			dfs(v, g, visited)
n = f()
a = sorted(f(2))
if a[0] == a[-1]:
	print(-1)
else:
	print(*a)


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
x = 0
for i in range(n):
	x += a[i]
f = 1
if not s % 2 and x == s // 2:
	f = 0
	for i in range(n):
		j = n
		while j < 2 * n:
			if a[i] != a[j]:
				(a[j], a[i]) = (a[i], a[j])
				f = 1
				break
			j += 1
		if f:
			break
if f:
	print(*a)
else:
	print(-1)


from sys import stdin
n = int(stdin.readline().strip())
l = list(map(int, stdin.readline().split()))
l.sort()
(s1, s2) = (0, 0)
for i in range(0, n):
	s1 += l[i]
for i in range(n, 2 * n):
	s2 += l[i]
if s1 == s2:
	print(-1)
else:
	for i in l:
		print(str(i) + ' ', end='')


n = int(input())
arr = list(map(int, input().split()))
new = set(arr)
if len(new) == 1:
	print(-1)
else:
	arr.sort()
	print(*arr)


n = 2 * int(input())
A = list(map(int, input().strip().split()))
A = sorted(A, reverse=True)
if n % 2 != 0:
	print(-1)
else:
	b = n // 2
	if sum(A[:b]) == sum(A[b:]):
		print(-1)
	else:
		print(' '.join(map(str, A)))


n = int(input())
li = list(map(int, input().split()))
li.sort()
flag = 1
for i in range(0, 2 * n - 1):
	if li[i] != li[i + 1]:
		flag = 0
		break
if flag:
	print(-1)
else:
	print(' '.join(list(map(str, li))))


n = int(input())
a = list(map(int, input().rstrip().split()))
m = len(a)
f = 0
a.sort()
for i in range(m):
	if sum(a[0:n]) != sum(a[n:m]):
		print(*a)
		f = 1
		break
	else:
		b = a[0]
		a = a[1:m]
		a.append(b)
if f == 0:
	print(-1)


n = int(input())
a = sorted(list(map(int, input().split())))
if sum(a[0:n]) == sum(a[n:]):
	print(-1)
else:
	print(' '.join([str(i) for i in 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())
nums = list(map(int, input().split()))
soma1 = soma2 = 0
string = []
soma1 = sum(nums[:n])
soma2 = sum(nums[-n:])
if soma1 != soma2:
	print(*nums)
	quit()
else:
	for i in range(n):
		for j in range(n * 2 - 1, n, -1):
			if nums[i] != nums[j]:
				aux = nums[i]
				nums[i] = nums[j]
				nums[j] = aux
				soma1 = soma2 = 0
				soma1 = sum(nums[:n])
				soma2 = sum(nums[-n:])
				if soma1 != soma2:
					print(*nums)
					quit()
				else:
					aux = nums[j]
					nums[j] = nums[i]
					nums[i] = aux
	else:
		print(-1)


t = int(input())
s = list(map(int, input().split()))
flag = -1
a = s[0]
count = 0
for i in s:
	if i == a:
		count = count + 1
if count == len(s):
	print(flag)
else:
	s.sort()
	print(*s)


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


n = int(input())
a = [int(elem) for elem in input().split()]
a.sort()
sum_min = 0
sum_all = 0
for i in range(2 * n):
	sum_all += a[i]
for i in range(n):
	sum_min += a[i]
if sum_min == sum_all - sum_min:
	print(-1)
else:
	for i in range(2 * n):
		print(a[i], end=' ')


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


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
sum1 = 0
sum2 = 0
i = 0
for x in a:
	if i < n:
		sum1 += x
		i += 1
	else:
		sum2 += x
if sum1 == sum2:
	print('-1')
else:
	for x in a:
		print(x, end=' ')


n = int(input())
a = sorted(list(map(int, input().split())))
if len(set(a)) == 1:
	print(-1)
	exit(0)
b = []
c = []
for k in range(n):
	b.append(a[k])
	c.append(a[2 * n - 1 - k])
d = b + c
print(*d, sep=' ')


n = int(input())
a = [i for i in input().split()]
if len(set(a)) == 1:
	print(-1)
else:
	(s, c, k) = (0, 0, 0)
	for i in range(n):
		s += int(a[i])
		c += int(a[n + k])
		k += 1
	if s == c:
		a = sorted(a)
		val = a[n]
		a[n] = a[n - 1]
		a[n - 1] = val
		print(' '.join(a))
	else:
		print(' '.join(a))


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 : map(int, input().split())
n = int(input())
l = L()
p = set(l)
if len(p) == 1:
	print(-1)
else:
	l.sort()
	print(*l)


n = int(input())
a = list(map(int, input().split()))
(q, w) = (0, 0)
ss = 0
for i in range(0, 2 * n):
	ss += a[i]
a.sort()
sc = 0
for i in range(n):
	sc += a[i]
if sc == ss - sc:
	print('-1')
else:
	for i in range(2 * n):
		print(a[i], end=' ')


n = int(input(''))
a = input('').strip(' ').split(' ')
a = list(map(int, a))
a.sort()
s = sum(a)
st = 0
for i in range(n):
	st += a[i]
if st != s // 2:
	for i in a:
		print(i, end=' ')
else:
	d = {}
	flag = False
	for i in range(n):
		d[a[i]] = i
	for i in range(n, 2 * n):
		if a[i] not in d:
			t = a[i]
			a[i] = a[n - 1]
			a[n - 1] = t
			flag = True
			break
	if flag:
		for i in a:
			print(i, end=' ')
	else:
		print(-1)


def change_arr(l: list, n: int):
	if sum(l[:n]) != sum(l[n:]):
		return l
	for i in range(n):
		for j in range(n):
			if l[i] != l[j + n]:
				(l[i], l[j + n]) = (l[j + n], l[i])
				return l
	return [-1]
n = int(input())
l = list(map(lambda x: int(x), input().split()))
print(*change_arr(l, n))


from sys import stdin, stdout
from collections import *
from math import ceil, floor, log, gcd
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp()
	l = li()
	x = sorted(l)
	s = sum(l)
	a = sum(x[:n])
	b = s - a
	if b == a:
		pr(-1)
		return
	print(*x)
for _ in range(1):
	solve()


import math
from collections import deque, defaultdict
from sys import stdin, stdout
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)


n = int(input())
a = []
all_equal = True
a_st = input()
z = a_st.split(' ')
for i in range(2 * n):
	a.append(int(z[i]))
	if i > 0 and all_equal == True:
		if a[i] != a[0]:
			all_equal = False
if all_equal == True:
	print(-1)
else:
	a.sort()
	for i in a:
		print(i)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
temp = sum(a)
add = 0
for i in range(n):
	add += a[i]
if temp - add == add:
	print(-1)
else:
	print(*a)


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


n = int(input())
ar = list(map(int, input().split()))
if len(set(ar)) < 2:
	print('-1')
else:
	print(*sorted(ar))


N = int(input())
array = input()
arr = [int(x) for x in array.split(' ')]
arr.sort()
s = sum(arr)
s1 = sum(arr[:N])
if s == 2 * s1:
	print(-1)
else:
	num = [str(x) for x in arr]
	print(' '.join(num))


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
if sum(arr[0:n]) != sum(arr[n:2 * n]):
	strarray = list(map(str, arr))
	print(' '.join(strarray))
else:
	print(-1)


n = int(input())
arr = [int(ele) for ele in input().split(' ')]
allEleSame = True
ele = arr[0]
if arr != [ele] * (2 * n):
	allEleSame = False
if allEleSame:
	print('-1')
else:
	arr.sort()
	for ele in arr:
		print(ele, end=' ')
	print('')


n = int(input())
a = list(map(int, input().split()))
a.sort()
A = 0
B = 0
for i in range(0, n, 1):
	A += a[i]
for j in range(n, 2 * n, 1):
	B += a[j]
if A == B:
	print(-1)
	exit()
else:
	for i in range(len(a)):
		print(a[i], end=' ')


def solution():
	n = int(input())
	ar = list(sorted(map(int, input().split())))
	s = sum(ar[:n])
	s2 = sum(ar[n:])
	if s == s2:
		print(-1)
		return
	for i in ar:
		print(i, end=' ')
solution()


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
if sum(a[:n]) != sum(a[n:2 * n]):
	print(*a)
else:
	print(-1)


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


n = int(input())
a = list(map(int, input().split()))
if len(set(a)) == 1:
	print(-1)
else:
	a.sort()
	print(' '.join([str(guy) for guy in a]))


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
if arr[-1] == arr[0]:
	print(-1)
else:
	s = ''
	s = ' '.join((str(u) for u in arr))
	print(s)


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()


N = int(input())
A = list(map(int, input().split()))
A.sort()
if sum(A[:N]) == sum(A[N:]):
	print(-1)
else:
	print(' '.join([str(a) for a in A]))


n = int(input())
A = list(map(int, input().split()))
k = 0
for i in range(0, 2 * n):
	if A[0] != A[i]:
		k = 1
		break
if k == 0:
	print(-1)
else:
	s1 = 0
	s2 = 0
	B = list()
	C = list()
	for i in range(0, n):
		s1 += A[i]
		B.append(A[i])
	for j in range(n, 2 * n):
		s2 += A[j]
		C.append(A[j])
	if s1 == s2:
		r = 1
		for i in range(0, n):
			if r == 0:
				break
			for j in range(0, n):
				if B[i] != C[j]:
					t = B[i]
					B[i] = C[j]
					C[j] = t
					r = 0
					break
		A = B + C
	print(' '.join(map(str, A)))


n = int(input())
a = list(map(int, input().split()))
b = set(a)
if len(b) == 1:
	print(-1)
	exit(0)
else:
	a = sorted(a)
for i in a:
	print(i, end=' ')


k = int(input())
z = [*map(int, input().split())]
if len(set(z)) == 1:
	print(-1)
else:
	print(' '.join((str(x) for x in sorted(z))))


t = int(input())
arr = [int(t) for t in input().split()]
arr.sort()
l = arr[:len(arr) // 2]
h = arr[len(arr) // 2:]
if sum(l) == sum(h):
	print(-1)
else:
	for i in range(t * 2):
		if i == t * 2 - 1:
			print(arr[i])
		else:
			print(arr[i], end=' ')


n = 2 * int(input())
li = sorted(list(map(int, input().split())))
(a, b) = (0, 0)
for num in range(n):
	if num < n // 2:
		a += li[num]
	else:
		b += li[num]
if a == b:
	print(-1)
else:
	for num in range(n):
		print(li[num], end=' ')


n = int(input())
z = n
a = input().split()
q1 = []
q2 = []
x = 0
y = 1
sum1 = 0
sum2 = 0
s = [int(num) for num in a]
for i in range(0, 2 * n):
	if s[i] == s[i + 1]:
		q = -1
		if i == 2 * n - 2:
			break
	else:
		q = 1
		break
if q == -1:
	print(q)
else:
	while True:
		while not n == 0:
			if s[x] >= s[y]:
				q1.append(s[x])
				q2.append(s[y])
			else:
				q1.append(s[y])
				q2.append(s[x])
			x += 2
			y += 2
			n -= 1
		for i in q1:
			sum1 += i
		for i in q2:
			sum2 += i
		if sum1 == sum2:
			s = q1 + q2
			q1 = []
			q2 = []
			x = 0
			y = 1
			n = z
			continue
		else:
			break
e = q1 + q2
for i in e:
	print(i, end=' ')


N = int(input())
ls = list(map(int, input().split()))
if len(set(ls)) == 1:
	print(-1)
else:
	if sum(ls[:N]) == sum(ls[N:]):
		for i in range(N):
			for j in range(N, 2 * N):
				if ls[i] != ls[j]:
					break
			else:
				continue
			break
		(ls[i], ls[j]) = (ls[j], ls[i])
	for i in ls:
		print(i, end=' ')
	print()


import sys
sys.setrecursionlimit(int(10000000.0))
R = lambda : map(int, input().split())

def main():
	((n,), l) = (R(), sorted(list(R())))
	if sum(l[:n]) == sum(l[n:]):
		print(-1)
	else:
		print(' '.join(map(str, l)))
	return
while 1:
	try:
		main()
	except EOFError:
		break


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


n = int(input())
s = list(map(int, input().split()))
if len(set(s)) == 1:
	print('-1')
else:
	print(' '.join(map(str, sorted(s))))


n = int(input())
a = list(map(int, input().split()))
f = 0
for k in range(len(a) - 1):
	if a[k] != a[k + 1]:
		f = 1
		break
if f == 1:
	if sum(a[:n]) == sum(a[n:]):
		(i, j) = (0, 2 * n - 1)
		while i <= n - 1 and a[i] == a[j]:
			i += 1
		t = a[i]
		a[i] = a[j]
		a[j] = t
	print(*a)
else:
	print('-1')


from collections import *
from math import *
import heapq
import sys
import os
import mmap
import html
from functools import partial
cin = lambda : [*map(int, input().split())]
n = cin()
a = cin()
a = sorted(a)
if a[0] == a[-1]:
	print('-1')
else:
	print(*a)


n = int(input())
a = list(map(int, input().split()))
a.sort()
status = 'Not ok'
d1 = sum(a[:len(a) // 2])
d2 = sum(a[len(a) // 2:])
if d1 != d2:
	status = 'ok'
if status != 'ok':
	if a[0] != a[len(a) - 1]:
		(a[0], a[len(a) - 1]) = (a[len(a) - 1], a[0])
		status = 'ok'
if status == 'ok':
	print(*a)
else:
	print(-1)


n = int(input())
b = list(map(int, input().split()))
a = []
s = 0
d = 0
count = 0
f = 0
if min(b) == max(b):
	count += 1
else:
	for i in range(n):
		a.append(max(b))
		b.remove(max(b))
if count > 0:
	print(-1)
else:
	print(*a + b)


import copy
n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
if arr[0:n] == arr[n:2 * n]:
	print('-1')
else:
	print(*arr)


def show():
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	a.sort()
	sum1 = 0
	sum2 = 0
	for i in range(2 * n):
		if i < n:
			sum1 = sum1 + a[i]
		else:
			sum2 = sum2 + a[i]
	if sum1 != sum2:
		for i in range(2 * n):
			print(a[i], end=' ')
	else:
		print('-1')
show()


n = int(input())
s1 = 0
s2 = 0
s = list(map(int, input().split()))
s.sort()
for i in range(n):
	s1 += s[i]
	s2 += s[n + i]
if s1 == s2:
	print(-1)
else:
	print(*s, sep=' ')


n = int(input())
v = sorted(map(int, input().split()))
if sum(v[:n]) * 2 == sum(v):
	print(-1)
else:
	print(' '.join(map(str, v)))


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


import sys
input = sys.stdin.readline
n = int(input())
l = list(map(int, input().split()))
if len(set(l)) == 1:
	print(-1)
else:
	l = sorted(l)
	print(*l)


n = int(input().strip())
arr = list(map(int, input().strip().split()))
arr.sort()
if arr[0] == arr[-1]:
	print(-1)
else:
	for elem in arr:
		print(elem, end=' ')


import sys
from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
from heapq import heappush as hpush
from heapq import heappop as hpop
mod = 10 ** 9 + 7

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
n = ri(1)
a = ri()
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()]
ans = 0
for i in a:
	ans += i
a.sort()
k = 0
for i in range(n):
	k += a[i]
if k * 2 == ans:
	print('-1')
else:
	for i in a:
		print(i, end=' ')


from sys import stdin, stdout
get = stdin.readline
put = stdout.write
n = int(get())
a = sorted(list(map(int, get().split())))
print(*(a if a[n:] != a[:n] else [-1]))


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
x = sum(arr[0:n])
y = sum(arr[n:])
if x == y:
	print('-1')
else:
	for i in arr:
		print(i, end=' ')
	print()


n = int(input())
a = list(map(int, input().split()))
a.sort()
s = 0
for i in range(n):
	s += a[i]
	s -= a[i + n]
if s == 0:
	print(-1)
else:
	print(' '.join(map(str, a)))


l = int(input())
s = [int(x) for x in input().split()]
s = sorted(s)
a = 0
b = 0
for i in range(0, l):
	a = a + s[i]
	b = b + s[i + l]
if a == b:
	print(-1)
else:
	for i in range(0, 2 * l):
		print(s[i], end=' ')


n = int(input())
L = input().split()
L.sort()
if L[0] == L[-1]:
	print(-1)
else:
	print(*L)


from collections import defaultdict as dd
import math

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
n = nn()
l = lm()
l.sort()
if l[0] == l[-1]:
	print(-1)
else:
	print(*l)


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
x = Counter(a)
if len(x) > 1:
	print(*sorted(a))
else:
	print(-1)


import sys
input = sys.stdin.readline

def ceil(x, y):
	return (x + y - 1) // y

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(10000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
a = sorted(int_array())
if sum(a[:n]) != sum(a[n:]):
	print(*a)
else:
	print(-1)


from sys import stdin
input = stdin.readline
n = int(input())
a = list(map(int, input().split()))
a.sort()
m = 0
for i in a[:n]:
	m += i
for i in a[n:]:
	m -= i
if m != 0:
	print(*a)
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
f = 0
for i in range(n):
	if a[i] != a[i + n]:
		f = 1
		break
if f == 1:
	print(*a)
else:
	print('-1')


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


n = int(input())
a = list(map(int, input().split()))
a.sort()
f = True
for i in range(len(a) - 1):
	if a[i] != a[i + 1]:
		f = False
if f:
	print(-1)
else:
	for i in range(2 * n):
		print(a[i], end=' ')


input()
a = [int(i) for i in input().split()]
a.sort()
if sum(a[:len(a) // 2]) != sum(a[len(a) // 2:]):
	print(' '.join([str(i) for i in a]))
else:
	print(-1)


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


for _ in range(1):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	flag = 1
	for i in range(2 * n - 1):
		if arr[i] == arr[i + 1]:
			flag += 1
	if flag == 2 * n:
		print(-1)
	else:
		temp = [str(x) for x in arr]
		print(' '.join(temp))


n = int(input())
ass = list(map(int, input().split()))
if all(map(lambda a: a == ass[1], ass)):
	print(-1)
else:
	bss = sorted(ass)
	if bss == ass:
		bss.reverse()
	print(' '.join(map(str, bss)))


import sys
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
readl = lambda : list(map(int, sys.stdin.readline().split()))
readt = lambda : tuple(map(int, sys.stdin.readline().split()))
read = lambda : sys.stdin.readline().rstrip()
readi = lambda : int(read())
readmi = lambda : map(int, sys.stdin.readline().split())
readms = lambda : map(str, sys.stdin.readline().split())
n = readi()
s = readl()
s.sort()
a = 0
for i in range(n):
	a += s[i]
b = 0
for i in range(n, 2 * n):
	b += s[i]
if a != b:
	for i in s:
		print(i, end=' ')
	print('')
else:
	print(-1)


n = int(input())
x = list(map(int, input().split()))
sum1 = 0
sum2 = 0
equal = True
i = 0
while i < 2 * n - 1 and equal:
	if x[i] != x[i + 1]:
		equal = False
	i += 1
if equal:
	print(-1)
else:
	x.sort()
	for i in x:
		print(i, end=' ')


n = int(input())
l = list(map(int, input().split()))
p = 2 * n
l.sort()
l1 = sum(l[0:n])
l2 = sum(l[n:p])
if l1 != l2:
	for i in l:
		print(i, end=' ')
else:
	print(-1)


n = int(input())
lst = [int(i) for i in input().split()]
a = set(lst)
if len(a) == 1:
	print(-1)
else:
	lst.sort()
	for i in lst:
		print(i, end=' ')


a = int(input())
arr = []
sum = 0
b = input()
sum3 = 0
arr = b.split(' ')
for x in range(a * 2):
	if x < a:
		sum += int(arr[x])
	sum3 += int(arr[x])
arr.sort()
sum2 = 0
sum3 -= sum
for x in range(a):
	sum2 += int(arr[x])
if sum == sum2 and sum == sum3:
	print(-1)
else:
	for x in range(a * 2):
		print(int(arr[x]), end=' ')
print()


n = int(input())
arr = list(map(int, input().split()))
a = arr[:n]
b = arr[n:]
a.sort()
b.sort()
if sum(a) != sum(b):
	print(' '.join(map(str, arr)))
else:
	while sum(a) == sum(b):
		maxa = max(a)
		minb = min(b)
		if maxa == minb:
			break
		(a[a.index(maxa)], b[b.index(minb)]) = (b[b.index(minb)], a[a.index(maxa)])
	if sum(a) != sum(b):
		print(' '.join(map(str, a)), ' '.join(map(str, b)))
	else:
		print(-1)


from sys import stdin
n = int(input())
arr = sorted(list(map(int, stdin.readline().split())))
(s1, s2) = (0, 0)
for i in range(n):
	s1 += arr[i]
for i in range(n, 2 * n):
	s2 += arr[i]
if s1 == s2:
	print(-1)
else:
	for i in arr:
		print(i, end=' ')
	print()


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


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()
if sum(arr[:len(arr) // 2]) != sum(arr[len(arr) // 2:]):
	print(*arr)
else:
	print(-1)


n = int(input())
a = [int(k) for k in input().split()]
a.sort()
if sum(a[:n]) != sum(a[n:]):
	for k in a:
		print(k, end=' ')
	print()
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
if len(set(a)) == 1:
	print('-1')
else:
	a.sort()
	print(' '.join(map(str, a)))


def thanos():
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(a[0]) == 2 * n:
		print('-1')
	else:
		a = sorted(a)
		print(' '.join(map(lambda v: str(v), a)))
thanos()


n = int(input())
a = input()
arr = list(map(int, a.split()))
if len(set(arr)) == 1:
	print(-1)
elif sum(arr[:n]) != sum(arr[n:]):
	print(a)
else:
	b = list(set(arr[:n]))
	for i in range(2):
		c = b[i]
		j = 0
		while j < n and arr[n + j] == c:
			j += 1
		if j != n:
			(arr[n + j], arr[arr.index(c)]) = (arr[arr.index(c)], arr[n + j])
			break
	ans = ''
	for d in arr:
		ans += str(d) + ' '
	print(ans)


import sys
import os
from io import BytesIO, IOBase

def cel(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return defaultdict(int)

def ddl():
	return defaultdict(list)

def ddd():
	return defaultdict(defaultdict(int))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
from math import gcd, log2, ceil
for _ in range(1):
	n = ii()
	a = li()
	a.sort()
	if a[0] == a[-1]:
		print(-1)
	else:
		print(*a)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
s1 = 0
s2 = 0
st = ''
for i in range(2 * n):
	if i < n:
		s1 += a[i]
	else:
		s2 += a[i]
	st += str(a[i]) + ' '
if s1 == s2:
	print(-1)
else:
	print(st)


n = int(input())
l = list(map(int, input().split()))
sum1 = sum(l[:n])
sum2 = sum(l[n:])
if sum1 != sum2:
	print(*l)
else:
	a = l[:n]
	b = l[n:]
	flag = 0
	for i in range(n):
		z = a[i]
		for j in range(n):
			if z != b[j]:
				flag = 1
				(a[i], b[j]) = (b[j], a[i])
				break
		if flag == 1:
			break
	if flag == 1:
		print(*a + b)
	else:
		print(-1)


n = int(input())
array = input()
l = list(array.split())
l.sort()
if l[0] == l[2 * n - 1]:
	print(-1)
else:
	for i in l:
		print(i, end=' ')


import sys
n = int(input())
arr = list(map(int, input().split()))
l = 2 * n
arr.sort()
sum1 = 0
sum2 = 0
for i in range(n):
	sum1 = sum1 + arr[i]
for j in range(n, l):
	sum2 = sum2 + arr[j]
if sum1 != sum2:
	print(*arr)
else:
	print('-1')


num = 2 * int(input())
data = [int(i) for i in input().split()]
data.sort()
if data[0] == data[-1]:
	print(-1)
else:
	[print(a, end=' ') for a in data]


def main():
	n = int(input())
	a = sorted(map(int, input().split()))
	if len(set(a)) == 1:
		print(-1)
	else:
		print(*a)
	return 0
main()


n = int(input())
a = list(map(int, input().split()))
a.sort()
s1 = sum(a[:n])
s2 = sum(a[n:2 * n])
if s1 == s2:
	print(-1)
else:
	for x in a:
		print(x, end=' ')
	print()


def get_arr(a):
	a.sort()
	l_sum = sum((a[i] for i in range(len(a) // 2)))
	r_sum = sum((a[i] for i in range(len(a) // 2, len(a))))
	if l_sum != r_sum:
		return a
	else:
		return [-1]

def main():
	n = int(input())
	a = list(map(int, input().split()))
	print(' '.join((str(i) for i in get_arr(a))))
main()


u = int(input())
a = list(map(int, input().split()))
f = 0
for i in range(2 * u - 1):
	if a[i] != a[i + 1]:
		f = 1
if f == 0:
	print('-1')
else:
	a.sort()
	print(*a)


def print_array(arr):
	for element in arr:
		print(element, '', end='')
	print('')
n = int(input())
string_input = input()
arr_input = string_input.split()
jumlah = 0
element_different = []
isFound = False
for index in range(n):
	num1 = int(arr_input[index])
	num2 = int(arr_input[index + n])
	jumlah += num1 - num2
	if index == 0:
		if num1 != num2:
			element_different.append((0, num1))
			element_different.append((n, num2))
		else:
			element_different.append((0, num1))
	elif not isFound:
		if num1 != element_different[0][1]:
			element_different.append((index, num1))
			isFound = True
		if num2 != element_different[0][1]:
			element_different.append((index + n, num2))
			isFound = True
if jumlah != 0:
	print_array(arr_input)
elif len(element_different) == 1:
	print(-1)
else:
	index1 = element_different[0][0]
	index2 = element_different[1][0]
	if index2 >= n:
		(arr_input[index1], arr_input[index2]) = (arr_input[index2], arr_input[index1])
		print_array(arr_input)
	elif index < n:
		(arr_input[n], arr_input[index2]) = (arr_input[index2], arr_input[n])
		print_array(arr_input)


def n_addition(n, a):
	if len(set(a)) == 1:
		return -1
	else:
		return ' '.join(list(map(str, sorted(a))))
n = int(input())
a = list(map(int, input().split()))
ans = n_addition(n, a)
print(ans)


n = int(input())
nums = list(map(int, input().split()))
nums.sort()
if sum(nums[:n]) != sum(nums[n:]):
	res = ''
	for (i, num) in enumerate(nums):
		res += str(num)
		if i < 2 * n - 1:
			res += ' '
	print(res)
else:
	print(-1)


n = int(input(''))
ch = input('')
a = ch.split(' ')
(x, y) = (0, 0)
v = True
for i in range(len(a)):
	a[i] = int(a[i])
	if i < n:
		x += a[i]
	else:
		y += a[i]
	if a[i] != int(a[0]):
		v = False

def affiche(liste):
	ch = ''
	for i in liste:
		ch += str(i) + ' '
	ch = ch[:len(ch) - 1]
	return ch
if y != x:
	print(affiche(a))
elif v == True:
	print('-1')
else:
	b = 0
	for i in range(0, n):
		if b == 1:
			break
		for j in range(n, 2 * n):
			if a[j] != a[i]:
				(a[j], a[i]) = (a[i], a[j])
				b += 1
				break
	print(affiche(a))


print(*(lambda a: sorted(a) if len(set(a)) - 1 else [-1])(input() and list(map(int, input().split()))))


n = int(input())
a_i = input()
a = a_i.split()
check = True
for i in range(len(a)):
	a[i] = int(a[i])
	if i > 0:
		if a[i] != a[i - 1]:
			check = False
a.sort()
for i in range(len(a)):
	a[i] = str(a[i])
if not check:
	print(' '.join(a))
else:
	print(-1)


n = int(input())
l = [int(i) for i in input().split()]
c = 1
for i in range(1, len(l)):
	if l[i - 1] == l[i]:
		c += 1
	else:
		break
if c == 2 * n:
	print(-1)
else:
	l.sort()
	for i in l:
		print(i, end=' ')
	print()


n = int(input())
L = list(map(int, input().split()))
L.sort()
fst = sum(L[0:2 * n // 2])
scd = sum(L[2 * n // 2:])
if fst == scd:
	print(-1)
else:
	for i in range(2 * n - 1):
		print(L[i], end=' ')
	print(L[2 * n - 1])


n = int(input())
l = list(map(int, input().split()))
l.sort()
ans1 = 0
for i in range(n):
	ans1 += l[i]
if sum(l) - ans1 != ans1:
	for i in range(2 * n):
		print(l[i], end=' ')
else:
	print(-1)


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


N = int(input())
X = sorted(list(map(int, input().split())))
if sum(X[:N]) == sum(X[N:]):
	print(-1)
else:
	print(*X)


n = int(input())
arr = [int(i) for i in input().split(' ')]
if arr.count(arr[0]) == len(arr):
	print(-1)
else:
	print(str(sorted(arr))[1:-1].replace(',', ''))


def gns():
	return [int(x) for x in input().split()]
n = int(input())
ns = gns()
sm = sum(ns)
if sm % 2 == 1:
	for c in ns:
		print(c, end=' ')
	print()
	quit()
s1 = 0
i = 0
while i < 2 * n:
	if ns[i] != ns[0]:
		break
	i += 1
if i == 2 * n:
	print(-1)
	quit()
s2 = i
ans = []
j = 0
while len(ans) < n - 1:
	if j != s1 and j != s2:
		ans.append(ns[j])
	j += 1
if sum(ans) + ns[s1] == sm // 2:
	ans.append(ns[s2])
	ans.append(ns[s1])
else:
	ans.append(ns[s1])
	ans.append(ns[s2])
while len(ans) < n * 2:
	if j != s1 and j != s2:
		ans.append(ns[j])
	j += 1
for c in ans:
	print(c, end=' ')
print()


import sys, os
f = lambda : list(map(int, input().split()))
if 'local' in os.environ:
	sys.stdin = open('./input.txt', 'r')

def solve():
	n = f()[0]
	a = f()
	asum = sum(a)
	first_half = sum(a[:n])
	if asum != first_half * 2:
		for i in range(2 * n):
			print(a[i], end=' \n'[i == 2 * n - 1])
		return
	else:
		set_first = set(a[:n])
		set_second = set(a[n:])
		if len(set_first) == 1 and len(set_second) == 1 and (a[0] == a[n]):
			print(-1)
			return
		found = 0
		for i in range(n):
			for j in range(n, 2 * n):
				if a[i] != a[j]:
					(a[i], a[j]) = (a[j], a[i])
					found = 1
					break
			if found:
				break
		for i in range(2 * n):
			print(a[i], end=' \n'[i == 2 * n - 1])
solve()


n = int(input())
p = input()
l = list(sorted([int(o) for o in p.split()]))
a = b = 0
for i in range(n):
	a += l[i]
for i in range(n, 2 * n):
	b += l[i]
if a == b:
	print(-1)
else:
	for i in range(2 * n):
		print(l[i], end=' ')


from math import *
n = int(input())
l = list(map(int, input().split()))
ans = 0
l.sort()
d = dict()
for i in l:
	if i not in d:
		d[i] = 1
	else:
		d[i] += 1
for (key, val) in d.items():
	if val == 2 * n:
		ans = -1
if ans != -1:
	for i in l:
		print(i, end=' ')
	print()
else:
	print(ans)


n = int(input())
nums = list(map(int, input().split()))
need = False
firt = 0
second = 0
for i in range(2 * n):
	if nums[i] != max(nums):
		need = True
		break
if need:
	nums.sort()
	print(*nums, end=' ')
else:
	print('-1')


def sint():
	return int(input())

def sara():
	return list(map(int, input().split()))

def sstr():
	s = input()
	return list(s[:len(s)])

def sints():
	return map(int, input().split())

def solve():
	n = sint()
	ara = sara()
	flg = False
	for i in range(2 * n - 1):
		if ara[i] != ara[i + 1]:
			flg = True
			break
	if flg:
		ara.sort()
		for i in ara:
			print(i, end=' ')
		print('')
	else:
		print(-1)
solve()


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()


from sys import stdin
n = int(stdin.readline())
a = sorted(map(int, stdin.readline().split()))
if sum(a[:n]) == sum(a[n:]):
	print(-1)
else:
	print(*a)


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


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


a = int(input())
my_list = sorted(list(map(int, input().split())))
if len(set(my_list)) == 1:
	print(-1)
else:
	print(*my_list)


n = int(input())
l = list(map(int, input().split()))
s = set(l)
f = len(s)
if f == 1:
	print(-1)
else:
	a = 0
	b = 0
	for i in range(n):
		a += l[i]
		b += l[n + i]
	if a == b:
		l.sort()
	for i in range(2 * n):
		print(l[i], end=' ')


n = int(input())
a = [int(e) for e in input().split()]
a.sort()
if sum(a[:n]) != sum(a[-n:]):
	print(' '.join((str(i) for i in a)))
else:
	print(-1)


a = int(input())
szamok = [int(x) for x in input().split()]
szamok = sorted(szamok)
kis = 0
nagy = 0
for x in range(a):
	kis = szamok[x] + kis
	nagy = szamok[a + x] + nagy
if kis != nagy:
	for x in range(len(szamok)):
		print(szamok[x], end=' ')
else:
	print(-1)


n = int(input())
left_sum = 0
right_sum = 0
flag = False
arr = list(map(int, input().split()))
left_sum = sum(arr[:n])
right_sum = sum(arr[n:])
if right_sum == left_sum:
	for i in range(n + 1):
		for j in range(n + 1, 2 * n):
			if arr[i] > arr[j] or arr[i] < arr[j]:
				temp = arr[i]
				arr[i] = arr[j]
				arr[j] = temp
				flag = True
				break
		if flag:
			break
	if not flag:
		print(-1)
	else:
		for i in range(2 * n):
			print(arr[i], end=' ')
else:
	for i in range(2 * n):
		print(arr[i], end=' ')


n = int(input())
a = str(input())
a = a.split(' ')
l = []
for i in a:
	l.append(int(i))
l = sorted(l)
s = 0
s1 = 0
for i in range(0, n):
	s = s + l[i]
for i in range(n, 2 * n):
	s1 = s1 + l[i]
if s1 != s:
	for i in l:
		print(i, end=' ')
else:
	print(-1)


n = int(input())
p = input().rstrip().split(' ')
if len(p) == 1:
	print(-1)
else:
	s = 0
	d = 0
	p.sort(key=int, reverse=True)
	for i in range(0, n):
		s = s + int(p[i])
	for i in range(n, len(p)):
		d = d + int(p[i])
	if s == d:
		print(-1)
	else:
		print(*p)


import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split(' ')]

def st():
	return input().rstrip('\n')

def val():
	return int(input())
n = val()
a = sorted(li())
(a1, a2) = (sum(a[:n]), sum(a[n:]))
print(-1 if a1 == a2 else ' '.join((str(e) for e in a)))


n = int(input())
l = list(map(int, input().split()))
l.sort()
p = []
q = []
for i in range(n):
	p.append(l[0])
	l.pop(0)
	q.append(l[-1])
	l.pop(-1)
if sum(p) == sum(q):
	print(-1)
else:
	print(*p, *q)


n = int(input())
a = list(map(int, input().split()))
s1 = sum(a[0:n])
s2 = sum(a[n:])
if s1 == s2:
	a1 = list(set(a))
	if len(a1) == 1:
		print(-1)
	else:
		a.sort()
		for j in a:
			print(j, end=' ')
else:
	for j in a:
		print(j, end=' ')


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


n = int(input())
a = list(map(int, input().split()))
if len(set(a)) == 1:
	print(-1)
else:
	a.sort()
	print(' '.join((str(a[i]) for i in range(2 * n))))


def partiiton(a):
	n = len(a)
	a.sort()
	first_hlf = a[:n // 2]
	second_hlf = a[n // 2:]
	if sum(first_hlf) != sum(second_hlf):
		return ' '.join([str(i) for i in a])
	else:
		(i, j) = (0, 0)
		while i < len(first_hlf) and j < len(second_hlf):
			if first_hlf[i] != second_hlf[j]:
				(first_hlf[i], second_hlf[j]) = (second_hlf[j], first_hlf[i])
				if sum(first_hlf) != sum(second_hlf):
					return ' '.join([str(i) for i in first_hlf + second_hlf])
			i += 1
			j += 1
	return -1
n = int(input())
a = list(map(int, input().split()))
print(partiiton(a))


n = int(input())
num = list(map(int, input().split()))
d = set(num)
if len(d) == 1:
	print(-1)
else:
	num.sort()
	print(*num)


def solve():
	N = int(input())
	A = sorted([int(k) for k in input().split()])
	if sum(A[:N]) == sum(A[N:]):
		print(-1)
		return
	print(' '.join(map(str, A)))
solve()


def main():
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	if a[0] == a[-1]:
		print(-1)
	else:
		for ai in a:
			print(ai, end=' ')
main()


from collections import deque
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
if sum(a[0:n]) * 2 != sum(a):
	print(*sorted(a))
else:
	print(-1)


n = int(input())
inn = [int(k) for k in input().split()]

def summs_are_equal():
	first_sum = 0
	second_sum = 0
	for i in range(0, 2 * n):
		if i < n:
			first_sum += inn[i]
		else:
			second_sum += inn[i]
	return first_sum == second_sum
if not summs_are_equal():
	print(' '.join(map(str, inn)))
else:
	inn.sort()
	if not summs_are_equal():
		print(' '.join(map(str, inn)))
	else:
		print(-1)


n = int(input())
array = list(map(int, input().strip().split()))
p = 0
for i in range(0, 2 * n):
	p += array[i]
array.sort()
m = 0
for i in range(0, n):
	m += array[i]
if m + m == p:
	print(-1)
else:
	for x in array:
		print(x)


n = int(input())
arr = sorted([int(p) for p in input().split()])
if sum(arr[:n]) != sum(arr[n:]):
	print(*arr)
else:
	print(-1)


import sys
input = sys.stdin.readline
from collections import *
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())
ar = list(map(int, input().split()))
first = ar[0:n]
second = ar[n:]
setA = set(first)
setB = set(second)
listA = list(setA)
listB = list(setB)
if len(listA) == 1 and len(listB) == 1 and (listA[0] == listB[0]):
	print(-1)
elif sum(first) != sum(second):
	new = first + second
	for i in new:
		print(i, end=' ')
else:
	first.sort()
	second.sort()
	for i in range(n):
		if first[i] != second[n - i - 1]:
			(first[i], second[n - i - 1]) = (second[n - i - 1], first[i])
			break
	new = first + second
	for i in new:
		print(i, end=' ')


a = int(input())
b = list(map(int, input().split()))
s = sum(b)
b.sort()
w = 0
for j in range(a):
	w += b[j]
	s -= b[j]
if w == s:
	print(-1)
else:
	print(*b)


n = int(input())
A = sorted(list(map(int, input().split())))
if sum(A[:n]) != sum(A[n:]):
	for i in range(len(A)):
		print(A[i], end='')
		if i != len(A) - 1:
			print(' ', end='')
else:
	print(-1)


n = int(input())
arr = list(map(int, input().split()))
if sum(arr[:n]) == sum(arr[n:]):
	if len(set(arr)) == 1:
		print(-1)
	else:
		indx1 = n
		indx2 = n - 1
		while arr[indx1] == arr[indx2]:
			indx2 -= 1
			if indx2 < 0:
				indx1 += 1
				indx2 = n - 1
		(arr[indx1], arr[indx2]) = (arr[indx2], arr[indx1])
		for i in arr:
			print(i, end=' ')
		print()
else:
	for i in arr:
		print(i, end=' ')
	print()


n = int(input())
a = sorted([int(x) for x in input().split()])
if sum(a[:len(a) // 2]) != sum(a[len(a) // 2:]):
	print(''.join([str(i) + ' ' for i in a])[:-1])
else:
	print('-1')


from math import sqrt

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
n = ii()
a = li()
s1 = 0
s2 = 0
a.sort()
for i in range(n):
	s1 += a[i]
for i in range(n, 2 * n):
	s2 += a[i]
if s1 == s2:
	print('-1')
else:
	print(*a)


n = int(input())
l = [int(i) for i in input().split()]
l1 = sorted(l)
if l == [l[0]] * len(l):
	print(-1)
else:
	for i in l1:
		print(i, end=' ')


from functools import reduce
n = int(input())
numeros = [int(e) for e in input().split(' ')]
numeros_ordenados = sorted(numeros, reverse=True)
soma_total = reduce(lambda a, b: a + b, numeros)
soma_metade_ordenada = reduce(lambda a, b: a + b, numeros_ordenados[0:n])
if soma_metade_ordenada * 2 == soma_total:
	print(-1)
else:
	[print(e, '', end='') for e in numeros_ordenados]


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def get(s):
	lenght = len(set(s))
	if lenght == 1:
		return False
	else:
		return True
input()
s = inlt()
if get(s):
	s.sort()
	for i in s:
		print(i, end=' ')
else:
	print('-1')


n = int(input())
s = list(map(int, input().split()))
s = sorted(s)
if sum(s[0:n]) == sum(s[n:]):
	print(-1)
else:
	print(' '.join(map(str, s)))


input()
l = sorted(input().split())
print([' '.join(l), '-1'][len(set(l)) == 1])


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	n = int(input())
	l = 2 * n
	arr = sorted(list(map(int, input().split())))
	if len(set(arr)) == 1:
		print(-1)
	else:
		print(*arr)
t = 1
for _ in range(t):
	main()


a = int(input())
lst = input().split()
lst = [int(x) for x in lst]
lst.sort()
if lst[0] == lst[2 * a - 1]:
	print(-1)
else:
	for i in range(len(lst)):
		print(lst[i], end=' ')


n = int(input())
l = list(map(int, input().split()))
c = 0
l.sort()
while sum(l[0:n]) == sum(l[n:]):
	a = l.pop(0)
	l.append(a)
	c = c + 1
	if c >= 2 * n + 1:
		break
if c >= 2 * n + 1:
	print(-1)
else:
	print(*l)


n = int(input())
lia = list(map(int, input().split()))
ab = list(set(lia)) * 2
lia.sort()
ab.sort()
if len(ab) == 2:
	print(-1)
	exit(0)
else:
	print(' '.join((str(i) for i in lia)))


n = int(input())
m = sorted(list(map(int, input().split())))
if sum(m[:n]) != sum(m[n:]):
	print(' '.join(map(str, m)))
else:
	print(-1)


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


I = lambda : map(int, input().split())
n = int(input())
li = list(I())
li.sort()
if li[0] == li[-1]:
	exit(print('-1'))
else:
	print(*li)


import math
mod = 1000000007

def power(a, b):
	res = 1
	b = b % (mod - 1)
	while b > 0:
		if b % 2 != 0:
			res = res % mod * (a % mod) % mod
		b = b // 2
		a = a % mod
		a = a * a % mod
	res = res % mod
	return res
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
if a[0] == a[2 * n - 1]:
	print('-1')
else:
	for i in range(2 * n):
		print(a[i], end=' ')


n = int(input())
a = input().split()
Summ = 0
for i in range(0, 2 * n):
	Summ += int(a[i]) % 2
if Summ % 2 != 0:
	print(*sorted(a), end='')
elif max(a) == min(a):
	print(-1)
else:
	print(*sorted(a), end='')


x = input()
y = input()
z = y.split()
w = [int(d) for d in z]
w.sort()
total1 = 0
total2 = 0
num = len(z)
for t in w[0:num // 2]:
	total1 = total1 + t
for u in w[num // 2:num]:
	total2 = total2 + u
if total2 != total1:
	print(*w)
else:
	print('-1')


n = int(input())
inn = input().split()
list = []
for i in inn:
	list.append(int(i))
list.sort()
a = []
b = []
for i in range(len(list) // 2):
	a.append(list[i])
	b.append(list[i + len(list) // 2])
if sum(a) == sum(b):
	i = 0
	while sum(a) == sum(b) and i != len(a):
		(a[i], b[-1 * i]) = (b[-1 * i], a[i])
		i += 1
if sum(a) != sum(b):
	list1 = a + b
	for i in list1:
		print(i, end=' ')
elif sum(a) == sum(b):
	print(-1)


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


import sys
from math import *
from fractions import gcd
readints = lambda : 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 _1174A():
	n = int(input())
	v = list(map(int, input().split()))
	v.sort()
	s1 = sum((x for x in v[:n]))
	s2 = sum((x for x in v[n:]))
	if s1 == s2:
		if v[0] == v[2 * n - 1]:
			print(-1)
			return
		else:
			(v[0], v[2 * n - 1]) = (v[2 * n - 1], v[0])
	print(*v)
_1174A()


n = int(input())
a = sorted(map(int, input().split()))
print(*[[-1], a][a < a[-1:]])


n = int(input())
l = list(map(int, input().split()))
l1 = []
s1 = sum(l)
for i in range(n):
	l1.append(l[i])
s2 = sum(l1)
if len(set(l)) == 1:
	print(-1)
elif s2 != s1 - s2:
	for i in l:
		print(i, end=' ')
	print()
else:
	l.sort()
	for i in l:
		print(i, end=' ')
	print()


input()
ar = sorted([int(x) for x in input().split()])
print(-1) if len(set(ar)) == 1 else print(*ar)


def thanos(lst):
	if lst.count(lst[0]) == len(lst):
		return [-1]
	return sorted(lst)
n = int(input())
a = [int(i) for i in input().split()]
for elem in thanos(a):
	print(elem)


import sys
input = sys.stdin.readline

def ii():
	return int(input())

def mi():
	return map(int, input().rstrip().split())

def lmi():
	return list(map(int, input().rstrip().split()))

def li():
	return list(input().rstrip())
n = ii()
a = lmi()
a.sort()
if sum(a[:n]) == sum(a[n:]):
	print(-1)
else:
	for i in a:
		print(i, end=' ')
	print()


import sys
inf = float('inf')
mod = 1000000007

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

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

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

def int1():
	return int(input())
import string
import math
from itertools import combinations

def main():
	n = int(input())
	a1 = get_array()
	i = 0
	k = 0
	a = sorted(a1)
	if sum(a[:n]) != sum(a[n:]):
		r = ' '.join(map(str, a))
		print(r)
	else:
		print('-1')
main()


s = int(input())
t = list(map(int, input().split()))
a = t[:s]
b = t[s:]
if len(set(t)) == 1:
	print(-1)
	exit()
if sum(a) == sum(b):
	a = sorted(a)
	b = sorted(b)
	(a[0], b[-1]) = (b[-1], a[0])
print(*a, *b)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
(s1, s2) = (0, 0)
for i in range(n):
	s1 += l[i]
	s2 += l[n + i]
if s1 != s2:
	print(*l)
else:
	print('-1')


def main():
	n = int(input())
	arr = input().split(' ')
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	sarr = sorted(arr)
	if sarr[0] == sarr[-1]:
		print(-1)
		return None
	st = ''
	for i in range(len(sarr)):
		st = st + str(sarr[i]) + ' '
	print(st)
main()


n = int(input())
a = list(map(int, input().split()))
b = a[len(a) // 2:]
a = a[:len(a) // 2]
if sum(a) == sum(b):
	found = False
	for i in range(len(a)):
		for j in range(len(b)):
			if a[i] != b[j]:
				(a[i], b[j]) = (b[j], a[i])
				found = True
				break
		if found:
			break
if sum(a) == sum(b):
	print(-1)
else:
	print(' '.join(map(str, a)), ' '.join(map(str, b)), sep=' ')


from collections import Counter

def solve():
	n = int(input())
	l = list(map(int, input().split()))
	c_1 = Counter(l)
	if len(c_1) != 1:
		print(*sorted(l))
	else:
		print(-1)
solve()


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)


n = int(input())
a = list(map(int, input().split()))
sum1 = 0
sum2 = 0
count = 0
for i in range(0, n):
	sum1 += a[i]
for i in range(n, 2 * n):
	sum2 += a[i]
if sum1 != sum2:
	for i in range(0, 2 * n):
		print(a[i], end=' ')
else:
	for i in range(0, n):
		for j in range(n, 2 * n):
			if abs(a[i] - a[j]) >= 1:
				temp = a[i]
				a[i] = a[j]
				a[j] = temp
				count = 1
				break
		else:
			continue
		break
	if count == 1:
		for i in range(0, 2 * n):
			print(a[i], end=' ')
	elif count == 0:
		print(-1)


n = int(input())
l = list(map(int, input().split()))
n1 = n
l.sort(reverse=True)
l1 = l[:n1]
l2 = l[n1:]
if sum(l1) == sum(l2):
	print(-1)
else:
	for i in l:
		print(i, end=' ')
	print()


n = int(input())
arr = [int(x) for x in input().split()]
u = list(dict.fromkeys(arr))
a1 = arr[:n]
a1.sort()
a2 = arr[n:]
a2.sort(reverse=True)
if len(u) == 1:
	print(-1)
elif sum(a1) != sum(a2):
	for x in arr:
		print(x, end=' ')
else:
	(a1[0], a2[0]) = (a2[0], a1[0])
	a = a1 + a2
	for x in a:
		print(x, end=' ')


a = int(input())
b = [int(x) for x in input().split()]
s = set(b)
if len(s) == 1:
	print('-1')
else:
	b.sort()
	for i in b:
		print(i, end=' ')


n = int(input())
x = list(map(int, input().split()))
x.sort()
x1 = x[:n]
x2 = x[n:]
if sum(x1) != sum(x2):
	x1 = map(str, x1)
	x2 = map(str, x2)
	print(' '.join(x1) + ' ' + ' '.join(x2))
else:
	print(-1)


n = int(input())
arr = list(map(int, input().split()))
sum1 = sum(arr[:n])
sum2 = sum(arr[n:])
if sum1 == sum2:
	change = False
	for i in range(n):
		for j in range(n, 2 * n):
			if sum1 - arr[i] + arr[j] != sum2 - arr[j] + arr[i]:
				(arr[i], arr[j]) = (arr[j], arr[i])
				change = True
				break
		if change:
			break
	if not change:
		print('-1')
	else:
		print(' '.join([str(x) for x in arr]))
else:
	print(' '.join([str(x) for x in 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())
A = list(map(int, input().split()))
A = sorted(A)
s1 = 0
for i in range(n):
	s1 = s1 + A[i] - A[n + i]
if s1 != 0:
	print(*A)
else:
	print(-1)


def isvalid(li):
	for i in li:
		if i != li[0]:
			return 0
	return 1
n = int(input())
l = input().split()
li = [int(i) for i in l]
li.sort()
li.reverse()
if isvalid(li):
	print(-1)
else:
	for i in li:
		print(i, end=' ')
	print()


x = int(input())
l = input().split()
m = []
for g in l:
	m.append(int(g))
m.sort()
a = sum(m[:x])
b = sum(m[x:])
if a == b:
	print(-1)
else:
	for x in m:
		print(x, end=' ')


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


sz = int(input())
l = [int(x) for x in input().split()]
l.sort()
s = 0
s1 = 0
x = sz * 2 - 1
for i in range(sz):
	s += l[i]
	s1 += l[x]
	x -= 1
if s == s1:
	print(-1)
else:
	for i in l:
		print(i, end=' ')


n = int(input())
a = list(map(int, input().split()))
a.sort()
ar = set(a)
if len(ar) == 1:
	print('-1')
else:
	print(*a, sep=' ')


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


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)


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


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