#include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) typedef long long ll; using namespace std; int inputValue(){ int a; cin >> a; return a; }; void inputArray(int * p, int a){ rep(i, a){ cin >> p[i]; } }; void inputVector(vector * p, int a){ rep(i, a){ int input; cin >> input; p -> push_back(input); } } template void output(T a, int precision) { if(precision > 0){ cout << setprecision(precision) << a << "\n"; } else{ cout << a << "\n"; } } bool isImpossible(vector & A, int N){ bool ret = true; int a0 = A[0]; if (a0 >= N) { return false; } rep(i, A.size()){ if (A[i] != a0) { ret = false; } } return ret; } int main(int argc, const char * argv[]) { // source code int N = inputValue(); vector A(N); vector R(N); rep(i, N){ A[i] = inputValue(); R[i] = i; } if (isImpossible(A, N)) { output(-1, 0); return 0; } rep(i, N){ rep(j, N){ if (i == j) { continue; } if (R[i] == A[i]) { if (R[i] != A[j] && R[j] != A[i]) { int temp = R[i]; R[i] = R[j]; R[j] = temp; } } } } rep(i, N){ output(R[i], 0); } return 0; }