#include <iostream>
#include <vector>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    if (N == 1) {
        cout << -1 << endl;
        return 0;
    } else if (N == 2) {
        if (((A[0] + 1) ^ (A[1] + 2)) == ((A[0] + 2) ^ (A[1] + 1))) {
            cout << 1 << " " << 2 << endl;
            cout << 2 << " " << 1 << endl;
        } else {
            cout << -1 << endl;
        }
        return 0;
    }
    vector<int> P1(N, -1);
    vector<int> P2(N, -1);
    int o_idx1 = -1;
    int o_idx2 = -1;
    int e_idx1 = -1;
    int e_idx2 = -1;
    for (int i = 0; i < N; i++) {
        if (A[i] % 2 == 0) {
            if (e_idx1 == -1) {
                e_idx1 = i;
            } else {
                e_idx2 = i;
            }
        } else {
            if (o_idx1 == -1) {
                o_idx1 = i;
            } else {
                o_idx2 = i;
            }
        }
    }
    if (o_idx2 != -1) {
        P1[o_idx1] = 1;
        P2[o_idx1] = 2;
        P1[o_idx2] = 2;
        P2[o_idx2] = 1;
        int now = 3;
        for (int i = 0; i < N; i++) {
            if (i == o_idx1 || i == o_idx2) {
                continue;
            } else {
                P1[i] = now;
                P2[i] = now;
                now++;
            }
        }
    } else {
        P1[e_idx1] = 2;
        P2[e_idx1] = 3;
        P1[e_idx2] = 3;
        P2[e_idx2] = 2;
        int now = 1;
        for (int i = 0; i < N; i++) {
            if (i == e_idx1 || i == e_idx2) {
                continue;
            } else {
                P1[i] = now;
                P2[i] = now;
                now++;
                if (now == 2) {
                    now += 2;
                }
            }
        }
    }
    for (int i = 0; i < N; i++) {
        cout << P1[i];
        if (i < N - 1) {
            cout << " ";
        }
    }
    cout << endl;
    for (int i = 0; i < N; i++) {
        cout << P2[i];
        if (i < N - 1) {
            cout << " ";
        }
    }
    cout << endl;
}