#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define f first
#define s second
#define pb push_back
#define sz(x) (int) x.size()
#define all(x) begin(x), end(x)
using namespace std;
 
const int N = 2e5 + 1, inf = LLONG_MAX / 2ll ;

int n,  a[N] ;

void solve() {
    cin >> n ;
    for (int i = 1 ; i <= n ; i++) {
        cin  >> a[i] ;
    }
    int len = (n + 1) / 2ll ;
    int pen = sz(set<int>(a + 1 , a + 1 + n)) ;
    if (pen != len) {
        cout << -1 << "\n" ;
    } else {
        map<int,int> cnt ;
        for (int i= 1 ;i <= n ; i++) {
            cnt[a[i]]++ ;
        }
        vector<pair<int,int>> v; 
        for(auto p : cnt) {
            v.pb({p.second, p.first}) ;
        }
        sort(all(v)) ;
        int ptr = 1 ;
        int j = 0 ; 
        while (j < sz(v) && v[j].first == 1) {
            a[ptr] = v[j].second ;
            ptr += 2, j++ ;
        }
        if (ptr - 2 > len) {
            cout << -1 << "\n" ;
            return ;
        }
        for (int i = 2 ; i <= len ; i += 2) {
            a[i] = v[j].second ;
            j++ ;
        }
        for (int i= 1 ; i <= len ; i++) {
            cout << a[i] << ' ' ;
        }
    }
}
 
signed main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(0);cout.tie(0);
    int T = 1 ;
    while (T--) {
        solve ( ) ;
    }
    return 0 ;
}