#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct BiMatch{
  int L,R;
  vector<vector<int> > G;
  vector<int> match,level;
  
  BiMatch(){}
  BiMatch(int L,int R):L(L),R(R),G(L+R),match(L+R,-1),level(L){}
  
  void add_edge(int u,int v){
    G[u].push_back(v+L);
    G[v+L].push_back(u);
  }
  
  bool bfs(){
    queue<int> q;
    for(int i=0;i<L;i++){
      level[i]=-1;
      if(match[i]<0){
        level[i]=0;
        q.emplace(i);
      }
    }
    while(!q.empty()){
      int v=q.front();q.pop();
      for(int u:G[v]){
        int w=match[u];
        if(w<0) return true;
        if(level[w]<0){
          level[w]=level[v]+1;
          q.emplace(w);
        }
      }
    }
    return false;
  }

  bool dfs(int v){
    for(int u:G[v]){
      int w=match[u];
      if(w<0||(level[w]>level[v]&&dfs(w))){
        match[v]=u;
        match[u]=v;
        return true;
      }
    }
    return false;
  }
  
  int build(){
    int res=0;
    while(bfs())
      for(int i=0;i<L;i++)
        if(match[i]<0&&dfs(i))
          res++;
    return res;
  }
  
};

//INSERT ABOVE HERE
signed main(){
  int n;
  cin>>n;
  BiMatch bm(n,n);
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    for(int j=0;j<n;j++)
      if(j!=a) bm.add_edge(i,j);
  }
  int k=bm.build();
  if(k!=n){
    cout<<-1<<endl;
    return 0;
  }
  for(int i=0;i<n;i++) cout<<bm.match[i]-n<<endl;
  return 0;
}