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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, A[101010];
set<int> S;
vector<int> seq;
int hate_count[101010];
set<pair<int, int>> hate; // # of hater, id

void emit()
{
	for (int i = 0; i < N; ++i) printf("%d%c", seq[i] + 1, i == N - 1 ? '\n' : ' ');
	exit(0);
}

void solve(int);

void step(int n, int pre, int v)
{
	if (n >= 1 && A[pre] == v) return;
	seq.push_back(v);
	S.erase(v);
	hate.erase({hate_count[v], v});

	solve(n + 1);

	hate.insert({hate_count[v], v});
	S.insert(v);
	seq.pop_back();
}

void solve(int n)
{
	if (n == N) {
		emit();
	}
	int pre = -1;
	if (n >= 1) pre = seq[n - 1];
	bool flg = false;
	if (pre != -1) {
		int nx = A[pre];
		if (hate.count({hate_count[nx], nx})) {
			flg = true;
			hate.erase(make_pair(hate_count[nx], nx));
			--hate_count[nx];
			hate.insert(make_pair(hate_count[nx], nx));
		}
	}

	bool sr = false;
	if (hate.size() > 0) {
		auto last = *--hate.end();
		//printf("%d, %d %d\n", n, last.first, last.second);
		if (last.first >= N - n) {

		} else if (last.first == N - n - 1) {
			step(n, pre, last.second);
		} else {
			sr = true;
		}
	}
	sr = true;

	if (sr) {
		for (int v = *S.begin(); ; ) {
			step(n, pre, v);
			auto nxt = ++S.lower_bound(v);
			if (nxt == S.end()) break;
			v = *nxt;
		}
	}

	if (pre != -1 && flg) {
		int nx = A[pre];
		hate.erase(make_pair(hate_count[nx], nx));
		++hate_count[nx];
		hate.insert(make_pair(hate_count[nx], nx));
	}
}

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		scanf("%d", A + i); --A[i];
	}
	for (int i = 0; i < N; ++i) ++hate_count[A[i]];
	for (int i = 0; i < N; ++i) S.insert(i);
	for (int i = 0; i < N; ++i) hate.insert({hate_count[i], i});
	solve(0);

	puts("-1");
	return 0;
}
