#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } if (n == 1) { cout << -1 << endl; return 0; } vector p(n); iota(p.begin(), p.end(), 1); if (n <= 9) { map> mp; do { int x = 0; for (int i = 0; i < n; i++) { x ^= a[i] + p[i]; } if (mp.find(x) == mp.end()) { mp[x] = p; } else { auto pp = mp[x]; for (int i = 0; i < n; i++) { cout << pp[i] << " "; } cout << "\n"; for (int i = 0; i < n; i++) { cout << p[i] << " "; } cout << "\n"; return 0; } } while (next_permutation(p.begin(), p.end())); cout << -1 << endl; return 0; } int s9 = 0; for (int i = 10; i <= n; i++) { s9 ^= a[i - 1] + i; } vector p9(9); iota(p9.begin(), p9.end(), 1); map> mp; do { int x = s9; for (int i = 0; i < 9; i++) { x ^= a[i] + p9[i]; } if (mp.find(x) == mp.end()) { mp[x] = p; } else { auto pp = mp[x]; for (int i = 0; i < 9; i++) { cout << pp[i] << " "; } for (int i = 10; i <= n; i++) { cout << i << " "; } cout << "\n"; for (int i = 0; i < 9; i++) { cout << p9[i] << " "; } for (int i = 10; i <= n; i++) { cout << i << " "; } cout << "\n"; return 0; } } while (next_permutation(p9.begin(), p9.end())); }