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;
const int N=1e5+5;
int n,a[N],d[N],t[N<<2];
void build(int l,int r,int k)
{
    if(l==r){t[k]=d[l];return;}
    int m=l+r>>1;
    build(l,m,k<<1);build(m+1,r,k<<1|1);
    t[k]=max(t[k<<1],t[k<<1|1]);
}
int qmx(int l,int r,int k)
{
    if(l==r) return l;
    int m=l+r>>1;
    if(t[k<<1]>=t[k<<1|1]) return qmx(l,m,k<<1);
    return qmx(m+1,r,k<<1|1);
}
void fix(int l,int r,int k,int x,int v)
{
    if(l==r){t[k]-=v;return;}
    int m=l+r>>1;
    if(x<=m) fix(l,m,k<<1,x,v);
    else fix(m+1,r,k<<1|1,x,v);
    t[k]=max(t[k<<1],t[k<<1|1]);
}
vector<int>v,s;
priority_queue<int,vector<int>,greater<int> >q,del;
bool flag=false;
bool judge()
{
    v.push_back(s[0]);v.push_back(s[1]);v.push_back(s[2]);
    for(int i=0;i<v.size()-1;i++)
        if(a[v[i]]==v[i+1])
    {
        v.pop_back();v.pop_back();v.pop_back();
        return false;
    }
    flag=true;
    return true;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) q.push(i);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]),d[a[i]]++;
    if(n==2){printf("-1\n");return 0;}
    build(1,n,1);
    for(int i=1;i<=n;i++)
    {
        if(t[1]==n-i) v.push_back(qmx(1,n,1)),del.push(v.back());
        else
        {
            while(!del.empty()&&!q.empty()&&del.top()==q.top()) del.pop(),q.pop();
            if(v.size()==0||a[v.back()]!=q.top()) v.push_back(q.top()),q.pop();
            else
            {
                int s=q.top();q.pop();
                while(!del.empty()&&!q.empty()&&del.top()==q.top()) del.pop(),q.pop();
                if(q.size()==0) v.push_back(s);
                else
                {
                    v.push_back(q.top());q.pop();
                    q.push(s);
                }
            }
        }
        fix(1,n,1,v.back(),n);
        fix(1,n,1,a[v.back()],1);
    }
    s.push_back(v.back());v.pop_back();
    s.push_back(v.back());v.pop_back();
    s.push_back(v.back());v.pop_back();
    sort(s.begin(),s.end());
    while(!judge())
        if(!next_permutation(s.begin(),s.end())) break;
    if(!flag){printf("-1\n");return 0;}
    for(int i=0;i<v.size();i++)
        printf(i==v.size()-1?"%d\n":"%d ",v[i]);
}
