#include <bits/stdc++.h>

#define pudge ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
//typedef tuple<ll, ll, ll> tll;

const ll INF = 2e18;
const double PI = acos(-1);
const ll MOD7 = 1e9 + (1000 - 7);
const ll MOD9 = 1e9 + 9;
const ll P = 31;
const ld E = 1e-6;
//const ll N = 6250001;
const ll N = 1000006;

ll check(vector<ll> &used) {
    for (int i = 0; i < used.size(); ++i)
        if (used[i] == 0) return 0;
    return 1;
}

int main() {
    pudge;

//    freopen("minmax.in", "r", stdin);
//    freopen("minmax.out", "w", stdout);

    ll n;
    cin >> n;
    vector<ll> a(n);
    set<ll> s;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        s.insert(a[i]);
    }
    if (n == 1) {
        cout << a[0] << "\n";
        return 0;
    }
    sort(a.begin(), a.end());
    if (s.size() * 2 != n + 1) {
        cout << -1 << "\n";
        return 0;
    }
    vector<ll> used(n, 0);
    set<ll> us;
    vector<ll> ans;
    for (int i = 0; i < n; ++i) {
        if (us.find(a[i]) == us.end()) {
            used[i] = 1;
            us.insert(a[i]);
            //ans.push_back(a[i]);
        }
    }
    for (int i = 0; check(used) == 0; ++i) {
        set<ll> now;
        vector<ll> idx;
        for (int j = 0; j < n; ++j) {
            if (used[j] == 0 && now.find(a[j]) == now.end()) {
                now.insert(a[j]);
                idx.push_back(j);
            }
        }
        if (now.size() * 2 == us.size()) {
            //vector <int> un(us.size(),  0);
            auto it = us.begin();
            int k = 0;
            set<int> need;
            set<int> est;
            for (int j = 0; j < us.size(); j++, it++) {
                if (now.find(*it) != now.end()) {
                    k++;
                    est.insert(*it);
                } else {
                    k--;
                    if (k < 0) {
                        cout << -1;
                        return 0;
                    }
                    if (i == 0) {
                        ans.push_back(*est.begin());
                        ans.push_back(*it);
                        est.erase(est.begin());
                    }
                }

            }


            us.clear();
            it = now.begin();
            for (int j = 0; j < now.size(); ++j) {
                us.insert(*it);
                used[idx[j]] = 1;
                ++it;
            }
        } else {
            cout << -1 << "\n";
            return 0;
        }
    }
    for (auto elem: ans)
        cout << elem << " ";
    cout << "\n";
    return 0;
}