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>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

const int MX = 100005;
int n, a[MX], in[MX], no, res[MX];
set<int> st;

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		in[a[i]]++;
		st.insert(i);
	}

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

	for (int i = 1; i <= n; i++) {
		auto it = st.begin();
		if (*it == no) it++;
		int nex = a[*it];

		if (i == n - 2) {
			vi v;
			for (auto x : st)
				if (st.count(a[x]))
					v.pb(x);

			if (v.size() == 2) {
				sort(all(v));
				
				if (a[v[0]] == v[1] && a[v[1]] == v[0]) {
					if (v[0] == no) swap(v[0], v[1]);
					cout << v[0] << " ";
					no = a[v[0]];
					in[no]--;
					st.erase(v[0]);
					continue;
				} 
			}
		}

		if (st.count(nex) && in[nex] == n - i) {
			assert(nex != no);
			cout << nex << " ";
			no = a[nex];
			in[no]--;
			st.erase(nex);
		} else {
			cout << *it << " ";
			no = a[*it];
			in[no]--;
			st.erase(it);
		}
	}

	cout << endl;

	return 0;
}