from itertools import permutations def solve_less10(): hm = dict() for p in permutations(range(1,n+1), n): xor = 0 for i in range(n): xor ^= p[i] + a[i] if xor in hm: print(*hm[xor]) print(*p) exit() hm[xor] = p print(-1) def solve_more10(): xor_base = 0 for i in range(11, n): xor_base ^= i + a[i] hm = dict() for p in permutations(range(1,11), 10): xor = 0 for i in range(10): xor ^= p[i] + a[i] if xor_base ^ xor in hm: print(*(hm[xor] + tuple(range(11, n)))) print(*(p + tuple(range(11, n)))) exit() hm[xor] = p print(-1) n = int(input()) a = list(map(int, input().split())) if n <= 10: solve_less10() else: solve_more10()