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 <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	cin>>n;
	int a[100010];
	int cnt[100010]={};
	for(int i=0; i<n; i++){
		cin>>a[i]; a[i]--;
		cnt[a[i]]++;
	}
	if(n==2){
		cout<<-1<<endl;
		return 0;
	}
	for(int i=0; i<n; i++){
		if(cnt[i]==n-1){
			cout<<i+1<<" ";
			bool used[100010]={};
			for(int j=0; j<n; j++){
				if(i!=j && a[i]!=j){
					cout<<j+1<<" ";
					used[i]=used[j]=1;
					break;
				}
			}
			for(int j=0; j<n; j++){
				if(!used[j]) cout<<j+1<<" ";
			}
			cout<<endl;
			return 0;
		}
	}
	vector<int> ans;
	int x=0;
	set<int> st;
	bool used[100010]={};
	used[0]=1;
	for(int i=1; i<n; i++) st.insert(i);
	for(int i=0; i<n-1; i++){
		if(cnt[a[x]]==n-1-i){
			int pr=ans.back();
			if(i==n-2){
				ans.pop_back();
				if(!ans.empty()){
					int z=ans.back();
					if(a[z]==min(x, a[x])){
						ans.push_back(max(x, a[x]));
						ans.push_back(pr);
						ans.push_back(min(x, a[x]));
						break;
					}
				}
				ans.push_back(min(x, a[x]));
				ans.push_back(pr);
				ans.push_back(max(x, a[x]));
				break;
			}
			ans.push_back(a[x]);
			st.insert(x);
			st.erase(a[x]);
			int y;
			if(*st.begin()==a[a[x]]){
				auto itr=st.begin();
				itr++;y=*itr;
				ans.push_back(y);
			}else{
				y=*st.begin();
				ans.push_back(y);
			}
			st.erase(y);
			for(auto z:st) ans.push_back(z);
			break;
		}else{
			int y;
			if(*st.begin()==a[x]){
				auto itr=st.begin(); itr++;
				y=*itr;
			}else{
				y=*st.begin();
			}
			st.erase(y);
			if(!used[a[x]]) cnt[a[x]]--;
			cnt[x]=0;
			used[x]=1;
			ans.push_back(x);
			x=y;
		}
	}
	if(ans.size()==n-1) ans.push_back(x);
	for(auto z:ans) cout<<z+1<<" ";
	cout<<endl;
	return 0;
}