#include #include #include #include using namespace std; int n; int arr[55]; int arr2[55]; mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); bool check() { for (int i = 0; i < n; ++i) { if (arr[i] == arr2[i]) return 0; } return 1; } int main() { // input cin >> n; for (int i = 0; i < n; ++i) cin >> arr[i]; for (int i = 0; i < n; ++i) arr2[i] = i; int cnt = 100; while (cnt--) { shuffle(arr2, arr2 + n, mt); if (check()) { for (int i = 0; i < n; ++i) { cout << arr2[i] << "\n"; } exit(0); } } cout << -1 << "\n"; }