import itertools n = int(input()) A = list(map(int, input().split())) s = max(n-10,0) t = n-s dic = {} for P in itertools.permutations(range(s+1,s+t+1)): y = 0 for i in range(s, s+t): y ^= P[i-s]+A[i] if(y in dic): print(*dic[y]) print(*P) exit() dic[y] = P print(-1)