#include #define all(x) x.begin(), x.end() using namespace std; typedef long long ll; mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<> dis(0, 1e9); int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector vec(n), arr(n); for (int &i : arr) cin >> i; for (int i = 0; i < n; i++) vec[i] = i; for (int k = 0; k < 100; k++) { shuffle(all(vec), mt); bool cc = true; for (int i = 0; i < n; i++) { if (arr[i] == vec[i]) cc = false; } if (cc) { for (int i = 0; i < n; i++) cout << vec[i] << '\n'; cout << '\n'; return 0; } } cout << "-1\n"; return 0; }