#include using namespace std; #define masterspark ios::sync_with_stdio(0), cin.tie(0),cout.tie(0),cin.exceptions(cin.failbit); template ostream &operator<<(ostream &s, pair v) { return s << "(" << v.first << ", " << v.second << ")";} template istream &operator>>(istream &s, pair &v) { return s >> v.first >> v.second; } template istream &operator>>(istream &s, vector &a) { for (auto &x:a) s>>x; return s; } template ostream &operator<<(ostream &s, vector &a) { int n=a.size(); if (!n) return s; s< #define ff first #define ss second #define forr(i,n) for(int i = 1; i <= n;++i) #define rep(i,j,n) for(int i = j; i < n;++i) #define PB push_back #define PF push_front #define EB emplace_back #define all(v) (v).begin(), (v).end() #define FZ(x) memset(x, 0, sizeof(x)) //fill zero #define SZ(x) ((int)x.size()) bool chmin(auto &a, auto b) { return (b < a) and (a = b, true); } bool chmax(auto &a, auto b) { return (a < b) and (a = b, true); } using i128 = __int128_t; using i64 = int64_t; using i32 = int32_t; mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); void solve(){ int n; cin >> n; vector B(n,0),A(n,0); iota(all(B),0); cin >> A; int t = 5000; while(t--){ shuffle(all(B),mt); bool valid = true; for(int i = 0; i < n;++i){ if(A[i] == B[i]) valid = false; } if(valid){ for(auto c:B) cout << c << '\n'; return; } } cout << "-1\n"; } signed main() { masterspark int t = 1; // freopen("stdin","r",stdin); // freopen("stdout","w",stdout); // cin >> t; while(t--){ solve(); } return 0; } /* /\_/\ (= ._.) / > \> */