Niwango has N cards, numbered 1,2,\ldots,N. He will now arrange these cards in a row.

Niwango wants to know if there is a way to arrange the cards while satisfying all the N conditions below. To help him, determine whether such a way exists. If the answer is yes, also find the lexicographically smallest such arrangement.

* To the immediate right of Card 1 (if any) is NOT Card a_1.
* To the immediate right of Card 2 (if any) is NOT Card a_2.
* \vdots
* To the immediate right of Card N (if any) is NOT Card a_N.

Constraints

* 2 \leq N \leq 10^{5}
* 1 \leq a_i \leq N
* a_i \neq i

Input

Input is given from Standard Input in the following format:


N
a_1 a_2 \ldots a_N


Output

If no arrangements satisfy the conditions, print `-1`. If such arrangements exist, print the lexicographically smallest such arrangement, in the following format:


b_1 b_2 \ldots b_N


Here, b_i represents the i-th card from the left.

Examples

Input

4
2 3 4 1


Output

1 3 2 4


Input

2
2 1


Output

-1


Input

13
2 3 4 5 6 7 8 9 10 11 12 13 12


Output

1 3 2 4 6 5 7 9 8 10 12 11 13
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    if(N==2){
        cout<<-1<<endl;
        return 0;
    }
    vector<int> A(N),cnt(N),ans;
    for(int i=0;i<N;i++){
        cin>>A[i];
        A[i]--;
        cnt[A[i]]++;
    }
    
    set<int> rem;
    set<pair<int,int>> SE;
    
    for(int i=0;i<N;i++){
        rem.insert(i);
        SE.insert({cnt[i],i});
    }
    
    while(rem.size()>=6){
        int a=(*SE.rbegin()).first,b=(*SE.rbegin()).second,c=*rem.begin();
        
        int pu=-1;
        
        if(a==rem.size()-1) pu=b;
        else if(ans.size()==0||A[ans.back()]!=c) pu=c;
        else{
            auto it=rem.begin();
            it++;
            pu=*it;
        }
        
        ans.push_back(pu);
        SE.erase({cnt[pu],pu});
        rem.erase(pu);
        
        SE.erase({cnt[A[pu]],A[pu]});
        cnt[A[pu]]--;
        SE.insert({cnt[A[pu]],A[pu]});
    }
    
    vector<int> S;
    for(auto a:rem) S.push_back(a);
    
    do{
        bool ok=true;
        for(int i=0;i+1<S.size();i++){
            if(A[S[i]]==S[i+1]) ok=false;
        }
        if(ok){
            for(int i=0;i<S.size();i++) ans.push_back(S[i]);
            break;
        }
        
    }while(next_permutation(all(S)));
    
    if(ans.size()!=N){
        cout<<-1<<endl;
        return 0;
    }
    
    for(int i=0;i<N;i++){
        cout<<ans[i]+1<<" ";
    }
    cout<<endl;
}
