#include #include #include using namespace std; constexpr int RT = 1e7; mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); int main() { int N; cin >> N; vector A(N); for(auto& i : A) cin >> i; vector ans(N); iota(ans.begin(), ans.end(), 0); auto check = [&]() -> bool { for(int i = 0; i < N; ++i) { if(ans[i] == A[i]) return false; } return true; }; for(int rt = 0; rt < RT; ++rt) { if(check()) break; shuffle(ans.begin(), ans.end(), mt); } if(check()) for(auto& i : A) cout << i << '\n'; else cout << "-1\n"; }