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;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int N; cin >> N;
  int a[N]; rep(i,N) { cin >> a[i]; a[i]--; }
  vector<int> in(N,N-1); rep(i,N) in[a[i]]--;
  set<int> count[N+1]; rep(i,N) count[in[i]].insert(i);
  set<int> left; rep(i,N) left.insert(i);
  // rep(i,N+1) cout << count[i].size() << " "; cout << endl;

  vector<int> result;
  if (count[0].size()>=2) { cout << -1 << endl; return 0; }
  int now = count[0].size()==1 ? *count[0].begin() : 0;

  rep(i,N) {
    // cout << now << endl;
    result.push_back(now);
    if (i!=N-1) {
      count[in[now]].erase(now); left.erase(now);
      if (left.count(a[now])) {
        count[in[a[now]]].erase(a[now]); count[in[a[now]]+1].insert(a[now]);
        in[a[now]]++;
      }
      // rep(i,N+1) cout << count[i].size() << " "; cout << endl;
      int to;
      if (count[i+1].size()==1) to = *count[i+1].begin();
      else {
        to = *left.begin();
        if (a[now]==to) to = *(++left.begin());
      }
      if (i==N-4) {
        auto p = left.begin();
        int t1 = *p, t2 = *(++p), t3 = *(++p);
        // cout << t1 << " " << t2 << " " << t3 << endl;
        if (a[now]!=t1&&a[t1]!=t2&&a[t2]!=t3) { 
          result.push_back(t1); result.push_back(t2); result.push_back(t3); 
        } 
        else if (a[now]!=t1&&a[t1]!=t3&&a[t3]!=t2) { 
          result.push_back(t1); result.push_back(t3); result.push_back(t2); 
        } 
        else if (a[now]!=t2&&a[t2]!=t1&&a[t1]!=t3) { 
          result.push_back(t2); result.push_back(t1); result.push_back(t3); 
        } 
        else if (a[now]!=t2&&a[t2]!=t3&&a[t3]!=t1) { 
          result.push_back(t2); result.push_back(t3); result.push_back(t1); 
        } 
        else if (a[now]!=t3&&a[t3]!=t1&&a[t1]!=t2) { 
          result.push_back(t3); result.push_back(t1); result.push_back(t2); 
        } 
        else if (a[now]!=t3&&a[t3]!=t2&&a[t2]!=t1) { 
          result.push_back(t3); result.push_back(t2); result.push_back(t1); 
        } 
        break;
      }
      now = to;
    }
  }
  // debug(all(result));
  
  rep(i,N) cout << result[i]+1 << " "; cout << endl;
  return 0;
}