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