#include <bits/stdc++.h>
#define int long long
#define str string
#define iphone ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define p_b push_back
#define first ff
#define second ss
using namespace std;
signed main(){
	vector <int> v;
	set <int> st;
    int n,ans=0;
    cin>>n;
    int a[n+1];
    for (int i=1;i<=n;i++) {
    	cin>>a[i];
    	v.p_b(a[i]);
    	st.insert(a[i]);
	}
	int i=0;
	for (auto it = st.begin(); it != st.end(); it++) {
		if (v[i]==*it) ans++;
		i++;
	}
	if (ans>=st.size()-1) {
	    cout<<"-1";
	    return 0;
	}
	else  {
		for (auto it = st.begin(); it != st.end(); it++) cout<<*it<<" ";
		return 0;
	}
	
	
}
/*
alignasa
alignasaa
alignasaaa
alignasaaaa
alignasaaaaa
alignasaaaaaa
alignasaaaaaaa
*/


