import std.conv, std.functional, std.range, std.stdio, std.string; import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons; import core.bitop; class EOFException : Throwable { this() { super("EOF"); } } string[] tokens; string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; } int readInt() { return readToken.to!int; } long readLong() { return readToken.to!long; } string COLOR(string s = "") { return "\x1b[" ~ s ~ "m"; } bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } } bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } } int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; } int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); } int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); } void main() { try { for (; ; ) { const N = readInt; auto A = new int[N]; foreach (i; 0 .. N) { A[i] = readInt; } int[][2] ans; if (N <= 4) { alias Entry = Tuple!(int, "val", int[], "ps"); Entry[] es; auto ps = iota(1, N + 1).array; do { int val; foreach (i; 0 .. N) { val ^= (ps[i] + A[i]); } es ~= Entry(val, ps.dup); } while (ps.nextPermutation); es.sort; foreach (h; 0 .. cast(int)(es.length) - 1) { if (es[h].val == es[h + 1].val) { ans[0] = es[h].ps; ans[1] = es[h + 1].ps; break; } } } else { auto iss = new int[][4]; foreach (i; 0 .. N) { iss[A[i] % 4] ~= i; } foreach (r; 0 .. 4) if (iss[r].length >= 2) { ans[0] = new int[N]; ans[0][] = -1; ans[0][iss[r][0]] = 1; ans[0][iss[r][1]] = 2; int now = 3; foreach (i; 0 .. N) if (!~ans[0][i]) { ans[0][i] = now++; } ans[1] = ans[0].dup; swap(ans[1][iss[r][0]], ans[1][iss[r][1]]); break; } } if (ans[0]) { foreach (h; 0 .. 2) { foreach (i; 0 .. N) { if (i) write(" "); write(ans[h][i]); } writeln; } } else { writeln(-1); } } } catch (EOFException e) { } }