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>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod009 = 1000000009;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int N, K, a[100000];
pair<int, int>tree[1 << 18];
set<int>st;
vector<int>res;


void update(int x, int t) {
	x += (1 << 17);
	tree[x].first = t;
	while (x) {
		x /= 2;
		tree[x] = max(tree[x + x], tree[x + x + 1]);
	}
}

bool func(int x) {
	if (x == N - 1) {
		if (a[res.back()] == *st.begin())return false;
		res.push_back(*st.begin());
		return true;
	}
	else {
		if (tree[1].first == N - x - 1) {
			auto p = tree[1];
			if (!res.empty() && a[res.back()] == p.second)return false;
			st.erase(p.second);
			res.push_back(p.second);
			update(p.second, 0);
			update(a[p.second], tree[(1 << 17) + a[p.second]].first - 1);
			if (func(x + 1))return true;
			res.pop_back();
			st.insert(p.second);
			update(a[p.second], tree[(1 << 17) + a[p.second]].first + 1);
			update(p.second, p.first);
		}
		else {
			auto it = st.begin();
			while (it != st.end()) {
				auto it2 = it;
				it2++;
				int t = *it;
				if (!(!res.empty() && a[res.back()] == t)) {
					st.erase(it);
					res.push_back(t);
					int k = tree[t + (1 << 17)].first;
					update(t, 0);
					update(a[t], tree[(1 << 17) + a[t]].first - 1);
					if (func(x + 1))return true;
					res.pop_back();
					st.insert(t);
					update(a[t], tree[(1 << 17) + a[t]].first + 1);
					update(t, k);
				}
				it = it2;
			}
		}
	}
	return false;
}

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		a[i]--;
		tree[i + (1 << 17)].second = i;
		tree[a[i] + (1 << 17)].first++;
		st.insert(i);
	}
	for (int i = (1 << 17) - 1; i; i--) {
		tree[i] = max(tree[i + i], tree[i + i + 1]);
	}
	if (func(0)) {
		for (int i = 0; i < N - 1; i++) {
			cout << res[i] + 1 << sp;
		}
		cout << res[N - 1] + 1 << endl;
	}
	else {
		cout << -1 << endl;
	}
}