You are given an array *a* with *n* distinct integers. Construct an array *b* by permuting *a* such that for every non-empty subset of indices *S* = {*x*<sub class="lower-index">1</sub>, *x*<sub class="lower-index">2</sub>, ..., *x*<sub class="lower-index">*k*</sub>} (1 ≤ *x*<sub class="lower-index">*i*</sub> ≤ *n*, 0 &lt; *k* &lt; *n*) the sums of elements on that positions in *a* and *b* are different, i. e.
The first line contains one integer *n* (1 ≤ *n* ≤ 22) — the size of the array.

The second line contains *n* space-separated distinct integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (0 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) — the elements of the array.
An array *x* is a permutation of *y*, if we can shuffle elements of *y* such that it will coincide with *x*.

Note that the empty subset and the subset containing all indices are not counted.
2
1 2
2 1 
4
1000 100 10 1
100 1 1000 10
5
1 3 4 5 2
5 2 3 4 1 
1
10000000
10000000 
4
1 5 8 4
8 4 5 1 
3
1 3 2
3 2 1 
4
3 1 2 4
2 4 1 3 
12
7 1 62 12 3 5 8 9 10 22 23 0
5 0 23 10 1 3 7 8 9 12 22 62 
17
1 3 2 5 4 6 7 8 10 9 13 11 12 14 15 16 18
18 2 1 4 3 5 6 7 9 8 12 10 11 13 14 15 16 
22
1 3 5 7 22 2 4 6 8 9 10 11 12 13 15 14 17 18 16 20 19 23
23 2 4 6 20 1 3 5 7 8 9 10 11 12 14 13 16 17 15 19 18 22 
22
17 6 1 22 9 23 38 40 10 20 29 11 12 39 3 32 26 4 13 36 14 35
14 4 40 20 6 22 36 39 9 17 26 10 11 38 1 29 23 3 12 35 13 32 
22
27 21 12 14 8 40 47 45 24 49 36 37 17 32 42 13 35 10 18 2 5 30
24 18 10 13 5 37 45 42 21 47 35 36 14 30 40 12 32 8 17 49 2 27 
22
33 2 19 26 18 13 27 9 25 35 6 24 20 22 11 5 1 30 17 15 7 29
30 1 18 25 17 11 26 7 24 33 5 22 19 20 9 2 35 29 15 13 6 27 
22
18 37 15 33 35 5 14 1 0 27 22 11 40 20 13 2 30 21 8 25 32 16
16 35 14 32 33 2 13 0 40 25 21 8 37 18 11 1 27 20 5 22 30 15 
22
4 24 22 18 28 3 17 8 29 20 11 15 13 2 19 26 5 36 33 14 30 25
3 22 20 17 26 2 15 5 28 19 8 14 11 36 18 25 4 33 30 13 29 24 
22
28 40 5 38 29 12 21 24 2 33 35 17 30 11 16 0 8 27 34 14 19 36
27 38 2 36 28 11 19 21 0 30 34 16 29 8 14 40 5 24 33 12 17 35 
22
25 12 38 5 6 20 30 27 4 19 8 18 10 17 26 32 43 14 40 35 1 22
22 10 35 4 5 19 27 26 1 18 6 17 8 14 25 30 40 12 38 32 43 20 
22
2 22 21 19 3 25 28 11 10 9 14 37 18 38 15 23 20 34 7 30 31 4
38 21 20 18 2 23 25 10 9 7 11 34 15 37 14 22 19 31 4 28 30 3 
22
7 0 23 37 20 18 46 26 2 24 44 13 47 15 32 5 35 30 39 41 27 10
5 47 20 35 18 15 44 24 0 23 41 10 46 13 30 2 32 27 37 39 26 7 
22
36 5 7 22 33 30 14 8 25 24 28 12 19 29 37 2 20 15 10 17 13 21
33 2 5 21 30 29 13 7 24 22 25 10 17 28 36 37 19 14 8 15 12 20 
22
23 32 13 39 29 41 40 6 21 10 38 42 4 8 20 35 31 26 15 2 17 5
21 31 10 38 26 40 39 5 20 8 35 41 2 6 17 32 29 23 13 42 15 4 
22
41 12 14 36 16 21 0 2 18 22 39 29 40 31 37 25 28 9 4 34 6 43
40 9 12 34 14 18 43 0 16 21 37 28 39 29 36 22 25 6 2 31 4 41 
22
32 43 3 37 29 42 40 12 28 1 14 25 34 46 8 35 5 17 2 23 20 9
29 42 2 35 28 40 37 9 25 46 12 23 32 43 5 34 3 14 1 20 17 8 
22
17 10 24 44 41 33 48 6 30 27 38 19 16 46 22 8 35 13 5 9 4 1
16 9 22 41 38 30 46 5 27 24 35 17 13 44 19 6 33 10 4 8 1 48 
22
16 11 29 30 12 5 3 2 13 6 17 15 9 24 25 35 1 27 0 23 20 33
15 9 27 29 11 3 2 1 12 5 16 13 6 23 24 33 0 25 35 20 17 30 
22
12 38 6 37 14 26 2 0 9 17 28 33 3 11 15 8 31 21 29 34 18 24
11 37 3 34 12 24 0 38 8 15 26 31 2 9 14 6 29 18 28 33 17 21 
22
20 38 26 32 36 8 44 0 40 41 35 21 11 17 29 33 1 42 24 14 5 3
17 36 24 29 35 5 42 44 38 40 33 20 8 14 26 32 0 41 21 11 3 1 
22
7 10 1 25 42 8 39 35 6 19 31 24 16 0 21 32 11 28 13 4 37 22
6 8 0 24 39 7 37 32 4 16 28 22 13 42 19 31 10 25 11 1 35 21 
22
9 13 7 20 38 40 27 12 31 25 1 23 46 35 45 29 19 16 33 4 42 39
7 12 4 19 35 39 25 9 29 23 46 20 45 33 42 27 16 13 31 1 40 38 
22
13 2 10 25 5 34 19 18 16 9 7 22 28 20 31 38 36 35 1 26 6 23
10 1 9 23 2 31 18 16 13 7 6 20 26 19 28 36 35 34 38 25 5 22 
22
106855341 41953605 16663229 140358177 145011760 49391214 42672526 1000000000 173686818 18529133 155326121 177597841 65855243 125680752 111261017 47020618 35558283 100881772 149421816 84207033 181739589 185082482
100881772 35558283 1000000000 125680752 140358177 47020618 41953605 185082482 155326121 16663229 149421816 173686818 49391214 111261017 106855341 42672526 18529133 84207033 145011760 65855243 177597841 181739589 
22
177663922 168256855 139197944 78700101 93490895 127229611 46317725 84284513 48674853 66142856 29224095 1000000000 138390832 117500569 98525700 100418194 44827621 151960474 43225995 16918107 53307514 48861499
168256855 151960474 138390832 66142856 84284513 117500569 44827621 78700101 46317725 53307514 16918107 177663922 127229611 100418194 93490895 98525700 43225995 139197944 29224095 1000000000 48861499 48674853 
22
83255567 39959119 124812899 157774437 12694468 89732189 102545715 67019496 110206980 98186415 63181429 141617294 177406424 195504716 158928060 64956133 67949891 31436243 155002729 1000000000 128745406 52504492
67949891 31436243 110206980 155002729 1000000000 83255567 98186415 64956133 102545715 89732189 52504492 128745406 158928060 177406424 157774437 63181429 67019496 12694468 141617294 195504716 124812899 39959119 
22
138499935 195582510 159774498 12295611 37071371 91641202 167958938 119995178 19438466 182405139 207729895 56797798 79876605 152841775 1000000000 149079380 158867321 154637978 72179187 75460169 145092927 103227705
119995178 182405139 158867321 1000000000 19438466 79876605 159774498 103227705 12295611 167958938 195582510 37071371 75460169 149079380 207729895 145092927 154637978 152841775 56797798 72179187 138499935 91641202 
22
133295371 188010892 71730560 209842234 193069109 184556873 87395258 234247052 230809052 211444018 148989732 17810977 158722706 11753932 100093528 1000000000 43672080 61357581 171830832 13873487 34865589 114340079
114340079 184556873 61357581 193069109 188010892 171830832 71730560 230809052 211444018 209842234 133295371 13873487 148989732 1000000000 87395258 234247052 34865589 43672080 158722706 11753932 17810977 100093528 
22
94506085 195061283 78884975 27418524 41348358 185397891 151515774 66605535 170723638 212843258 218566729 7450050 21809921 1000000000 146101141 132453297 228865386 240705035 57636433 114219677 158240908 228428432
78884975 185397891 66605535 21809921 27418524 170723638 146101141 57636433 158240908 195061283 212843258 1000000000 7450050 240705035 132453297 114219677 228428432 228865386 41348358 94506085 151515774 218566729 
22
116213533 171312666 76695399 60099180 30779320 43431323 146620629 15321904 71245898 94843310 56549974 104020167 84091716 134384095 24383373 83975332 1000000000 101710173 188076412 199811222 153566780 115893674
115893674 153566780 71245898 56549974 24383373 30779320 134384095 1000000000 60099180 84091716 43431323 101710173 83975332 116213533 15321904 76695399 199811222 94843310 171312666 188076412 146620629 104020167 
22
79749952 42551386 1000000000 60427603 50702468 16899307 85913428 116634789 151569595 100251788 152378664 96284924 60769416 136345503 59995727 88224321 29257228 64921932 77805288 126026727 103477637 115959196
77805288 29257228 152378664 59995727 42551386 1000000000 79749952 115959196 136345503 96284924 151569595 88224321 60427603 126026727 50702468 85913428 16899307 60769416 64921932 116634789 100251788 103477637 
22
32119698 129510003 107370317 182795872 160438101 17245069 117836566 141016185 196664039 215252245 170450315 18866624 68629021 47385728 77249092 89835593 132769095 95649030 48749357 126701972 40219294 1000000000
18866624 126701972 95649030 170450315 141016185 1000000000 107370317 132769095 182795872 196664039 160438101 17245069 48749357 40219294 68629021 77249092 129510003 89835593 47385728 117836566 32119698 215252245 
22
148671024 180468173 99388811 78666746 187172484 157360521 112604605 2988530 60271244 163263697 27469084 166381131 1000000000 125847469 137766458 198740424 88387613 15152912 200315776 149201551 45997250 36252057
137766458 166381131 88387613 60271244 180468173 149201551 99388811 1000000000 45997250 157360521 15152912 163263697 200315776 112604605 125847469 187172484 78666746 2988530 198740424 148671024 36252057 27469084 
n = int(input())
A = [int(a) for a in input().split(' ')]
S = set(A)
B = []

for i in range(n):
    s = max(S, key=lambda s: abs(A[i]-s))
    B.append(s)
    S.remove(s)

def check():
    for i in range(n):
        for j in range(i, n):
            if not (i == 0 and j == n-1) and sum(A[i:j+1]) == sum(B[i:j+1]):
                return False
    return True

if check():
    print(' '.join([str(b) for b in B]))
else:
    print(-1)