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;

const int maxN = 1e5 + 10;

int n, a[maxN + 1], deg[maxN + 1];
int mx, mn1, mn2;
bool flag[maxN + 1];

set<int> s[maxN + 1];

inline int read()
{
	int num = 0, f = 1;
	char ch = getchar();
	while( !isdigit( ch ) ) { if(ch == '-') f = -1; ch = getchar(); }
	while( isdigit( ch ) ) num = (num << 3) + (num << 1) + (ch ^ 48), ch = getchar();
	return num * f;
}

inline void del(int x)
{
	int y = a[x];
	s[ deg[x] ].erase(x);
	if(!flag[y])
	{
		s[ deg[y] ].erase(y);
		deg[y] --;
		s[ deg[y] ].insert(y);
	}
	flag[x] = true;

	while(flag[mn1]) mn1 ++;
	mn2 = mn1 + 1;
	while(flag[mn2]) mn2 ++;
	while(mx >= 0 && !s[mx].size()) mx --;
}

inline void work()
{
	for(int i = 1; i <= n; i++) s[ deg[i] ].insert(i);
	
	mn1 = 1; mn2 = 2;
	mx = n - 1;
	while(mx >= 0 && !s[mx].size()) mx --;
	
	int last = 0;
	for(int i = n; i >= 4; i--)
	{
		int now;
		if(mx == i - 1) now = (*s[mx].begin());
		else if(mn1 != a[last]) now = mn1;
			else now = mn2;
		printf("%d ", now);
		del(now);
		last = now;
	}
	
	int t[4], c = 0;
	t[c] = last;
	for(int i = 1; i <= n; i++)
		if(!flag[i]) t[++ c] = i;
	do
	{
		bool fk = true;
		for(int i = 1; i <= 3; i++)
			if(t[i] == a[ t[i - 1] ]) fk = false;
		if(fk)
		{
			for(int i = 1; i <= 3; i++) printf("%d ", t[i]);
			puts("");
			return;
		}
	}while(next_permutation(t + 1, t + 4));

	puts("-1");
}

int main()
{
	n = read();
	for(int i = 1; i <= n; i++) a[i] = read(), deg[ a[i] ] ++;
	
	if(n <= 2) { puts("-1"); return 0; }	

	work();
	return 0;
}
