#include #include #define rep(i,n) for(int i=0;i vi; typedef vector vl; typedef vector> vvi; typedef vector> vvl; typedef long double ld; typedef pair P; ostream& operator<<(ostream& os, const modint& a) {os << a.val(); return os;} template ostream& operator<<(ostream& os, const static_modint& a) {os << a.val(); return os;} template ostream& operator<<(ostream& os, const dynamic_modint& a) {os << a.val(); return os;} template istream& operator>>(istream& is, vector& v){int n = v.size(); assert(n > 0); rep(i, n) is >> v[i]; return is;} template ostream& operator<<(ostream& os, const pair& p){os << p.first << ' ' << p.second; return os;} template ostream& operator<<(ostream& os, const vector& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;} template ostream& operator<<(ostream& os, const vector>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;} template void chmin(T& a, T b){a = min(a, b);} template void chmax(T& a, T b){a = max(a, b);} int main(){ int n; cin >> n; vector a(n); cin >> a; if(n == 1){ cout << "-1\n"; return 0; } if(n == 2){ if(((a[0] + 1) ^ (a[1] + 2)) == ((a[0] + 2) ^ (a[1] + 1))){ cout << "1 2\n"; cout << "2 1\n"; }else cout << "-1\n"; return 0; } vector odd; vector even; rep(i, n){ if(a[i] % 2) odd.push_back(i); else even.push_back(i); } if(int(odd.size()) >= 2){ int i = odd[0]; int j = odd[1]; vector p(n, -1); vector q(n, -1); p[i] = 1; p[j] = 2; q[i] = 2; q[j] = 1; int val = 3; rep(k, n){ if(k == i or k == j) continue; p[k] = val; q[k] = val; val++; } cout << p; cout << q; return 0; } { assert(int(even.size()) >= 2); int i = even[0]; int j = even[1]; vector p(n, -1); vector q(n, -1); p[i] = 2; p[j] = 3; q[i] = 3; q[j] = 2; int val = 1; rep(k, n){ if(k == i or k == j) continue; p[k] = val; q[k] = val; val++; if(val == 2) val = 4; } cout << p; cout << q; } return 0; }