#include <iostream>
#include <cstring>
#include <queue>
#include <vector>
#include <utility>

using namespace std;

typedef pair<int,int> ii;

typedef vector<int> VI;
typedef vector<VI> VVI;

bool FindMatch(int i, const VVI &w, VI &mr, VI &mc, VI &seen) {
    for (int j = 0; j < w[i].size(); j++) {
        if (w[i][j] && !seen[j]) {
            seen[j] = true;
            if (mc[j] < 0 || FindMatch(mc[j], w, mr, mc, seen)) {
                mr[i] = j;
                mc[j] = i;
                return true;
            }
        }
    }
    return false;
}

int BipartiteMatching(const VVI &w, VI &mr, VI &mc) {
    mr = VI(w.size(), -1);
    mc = VI(w[0].size(), -1);
    
    int ct = 0;
    for (int i = 0; i < w.size(); i++) {
        VI seen(w[0].size());
        if (FindMatch(i, w, mr, mc, seen)) ct++;
    }
    return ct;
}


int main(int argc, const char * argv[])
{
    int n;
    cin>>n;
    VVI f;
    for(int ctr1=0;ctr1<n;ctr1++){
        VI t(n,1);
        f.push_back(t);
    }
    for(int ctr1=0;ctr1<n;ctr1++){
        int a;
        cin>>a;
        f[ctr1][a]=0;
    }
    VI rez,rez2;
    int r=BipartiteMatching(f, rez, rez2);
    if(r!=n){
        cout<<-1;
        
    }
    else{
        for(int ctr1=0;ctr1<n;ctr1++){
            cout<<rez[ctr1]<<endl;
        }
    }
    return 0;
}