from itertools import * N = int(input()) A = list(map(int, input().split())) M = min(N, 10) D = dict() for t in permutations(range(1, M + 1)): v = 0 for i in range(M): v ^= t[i] + A[i] if v in D: print(*(list(t) + list(range(M + 1, N + 1)))) print(*(list(D[v]) + list(range(M + 1, N + 1)))) exit() D[v] = t print(-1)