#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 <= 10) { 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 s10 = 0; for (int i = 10; i < n; i++) { s10 ^= a[i] + (i + 1); } vector p10(10); iota(p10.begin(), p10.end(), 1); map> mp; do { int x = s10; for (int i = 0; i < 10; i++) { x ^= a[i] + p10[i]; } if (mp.find(x) == mp.end()) { mp[x] = p; } else { auto pp = mp[x]; vector ans1(n); vector ans2(n); for (int i = 0; i < 10; i++) { ans1[i] = pp[i]; ans2[i] = p10[i]; } for (int i = 10; i < n; i++) { ans1[i] = i + 1; ans2[i] = i + 1; } int s1 = 0, s2 = 0; for (int i = 0; i < n; i++) { s1 ^= a[i] + ans1[i]; s2 ^= a[i] + ans2[i]; } assert(s1 == s2); for (int i = 0; i < n; i++) { cout << ans1[i] << " "; } cout << "\n"; for (int i = 0; i < n; i++) { cout << ans2[i] << " "; } cout << "\n"; return 0; } } while (next_permutation(p10.begin(), p10.end())); }