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 rep(i, n) for (rint i = 1; i <= (n); i++)
#define re0(i, n) for (rint i = 0; i < (int) n; i++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template <class T> inline void read(T &x) {
	x = 0; char c = getchar(); int f = 0;
	for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
	for (; c >= '0' && c <= '9'; x = x * 10 + c - '0', c = getchar());
	if (f) x = -x;
}

const int N = 2e5 + 2333;
int n, a[N], du[N];
set <int> s;
set <pair <int, int> > mx;
vector <int> vec;

int main(void) {
	read(n);
	rep (i, n) read(a[i]), s.insert(i), ++du[a[i]];
	rep (i, n) mx.insert({du[i], i});
	int ban = 0;
	while (s.size() > 5) {
		int v = -1;
		if (!mx.empty() && (--mx.end())->first == s.size() - 1) {
			v = (--mx.end())->second;
		} else {
			for (auto it = s.begin(); ; ++it) {
				if (*it != ban) {
					v = *it;
					break;
				}
			}
		}
		assert(v != -1);
		vec.push_back(v);
		ban = a[v];
		s.erase(v);
		mx.erase({du[v], v});
		pair <int, int> t = {du[ban], ban};
		if (mx.count(t)) {
			mx.erase(t);
			du[ban]--; t.first--;
			mx.insert(t);
		}
	}
	vector <int> ret;
	for (auto u : s) ret.push_back(u);
	sort(ret.begin(), ret.end());
	bool found = false;
	do {
		bool valid = true;
		int b = ban;
		for (auto u : ret) {
			if (u == b) {
				valid = false;
			}
			b = a[u];
		}
		if (valid) {
			found = true;
			break;
		}
	} while (next_permutation(ret.begin(), ret.end()));

	if (found == false) {
		cout << -1 << "\n";
		return 0;
	}
	for (auto u : vec) cout << u << " " ;
	for (auto u : ret) cout << u << " " ; cout << "\n";
}
