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;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i], a[i]--;

    if(n == 2) {
        cout << -1 << endl;
        return 0;
    }

    map<ll, ll> mp;
    REP(i, n) mp[a[i]]++;
    set<ll> st;
    REP(i, n) st.insert(i);
    vector<ll> ans;

    auto add = [&](ll x) {
        ans.push_back(x);
        st.erase(x);
        mp[a[x]]--;
        if(mp[a[x]] == 0) mp.erase(a[x]);
    };

    REP(i, n) {
        ll mi = st.size() ? *st.begin() : INF;
        ll mi2 = st.size()>=2 ? *(next(st.begin())) : INF;
        // dump(ans, st, mp);
        if(mp.size() == 2) {
            auto p1 = *mp.begin();
            auto p2 = *(next(mp.begin()));
            if(st.find(p1.first) != st.end() && p2.second == 1) {
                add(p1.first);
                continue;
            }
            if(st.find(p2.first) != st.end() && p1.second == 1) {
                add(p2.first);
                continue;
            }
        } 
        if(st.size() == 3) {
            vector<ll> v;
            for(auto j: st) v.push_back(j);
            bool f0 = true, f1 = true, f2 = true;
            if(a[v[1]] == v[2] && a[v[2]] == v[1]) f0 = false;
            if(i && a[ans.back()] == v[0]) f0 = false;
            if(a[v[0]] == v[2] && a[v[2]] == v[0]) f1 = false;                
            if(i && a[ans.back()] == v[1]) f1 = false;
            if(a[v[0]] == v[1] && a[v[1]] == v[0]) f2 = false;
            if(i && a[ans.back()] == v[2]) f2 = false;

            if(f0) add(v[0]);
            else if(f1) add(v[1]);
            else if(f2) add(v[2]);
            else {
                cout << -1 << endl;
                return 0;
            }
        }
        else if(i == 0) add(0);
        else if(a[ans.back()] == mi) add(mi2);
        else add(mi);
    }

    REP(i, n) cout << ans[i]+1 << (i==n-1 ? '\n': ' ');
    cout << flush;

    return 0;
}