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)): P = list(P) y = 0 for i in range(s, s+t): y ^= P[i-s]+A[i] if(y in dic): print(*(list(range(1,s+1)) + dic[y])) print(*(list(range(1,s+1)) + P)) exit() dic[y] = P print(-1)