#ifdef Local
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;
#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;


template<typename T>
istream &operator>>(istream &in, vector<T> &a) {
    for (auto &i: a)in >> i;
    return in;
}

template<typename T>
ostream &operator<<(ostream &out, vector<T> &a) {
    for (auto &i: a)out << i << ' ';
    return out;
}

bool cmp(pair<ld, int> x, pair<ld, int> y) {
    return x.second < y.second;
}

ll fastpow(ll r, int st) {
    if (st <= 0) return 1;
    ll fp = fastpow(r, st / 2);
    if (st % 2 == 0) return fp * fp;
    return fp * fp * r;
}

void solve() {
    ll n;
    cin >> n;
    vector<ll> v(n);
    cin >> v;
    ll t = (n + 1) / 2;
    vector<ll> ans(t);
    map<ll, vector<pair<ll, bool>>> mp;
    sort(v.begin(), v.end());
    map<ll, ll> mp1;
    for (int i = 0; i < n; i++) {
        mp1[v[i]]++;
    }
    v.erase(unique(v.begin(), v.end()), v.end());
    //cout<<v<<"\n";
    //cout<<v<<"\n";
    if (ans.size() != v.size()) {
        cout << -1 << "\n";
        return;
    }
    ll tt = 0;
    for (int i = 0; i <= 100; i++) {
        if (n + 1 == (1ll << i)) {
            tt = i;
            break;
        }
    }
    //cout<<tt<<"\n";
    if (mp1[v[0]] != tt) {
        cout << -1 << "\n";
        return;
    }
    for (ll i = 1; i <= tt - 1; i++) {
        mp[i].push_back({(1ll << (tt - 1 - i)), 1});
        //cout<<(1<<(tt-1-i))<<" "<<i<<"\n";
    }
    ans[0] = v[0];
    for (int i = 1; i < v.size(); i++) {
        ll cnt = mp1[v[i]];
        if (mp[cnt].size() == 0) {
            cout << -1 << "\n";
            return;
        }
        pair<ll, ll> p = mp[cnt][mp[cnt].size() - 1];
        mp[cnt].erase(mp[cnt].end() - 1);
        ll ttt = p.first;
        for (int j = 1; j <= cnt; j++) {
            ttt = 2 * ttt + p.second;
            mp[cnt - j].push_back({ttt, 1 - p.second});
        }
        if (p.second == 1) {
            ans[p.first * ((1ll << (cnt))) - n / 2 - 1 + (1ll << cnt) - 1] = v[i];
        } else {
            ans[p.first * ((1ll << (cnt))) - n / 2 - 1] = v[i];
        }
    }
    cout << ans << "\n";
}

signed main() {
#ifdef Local
    freopen("in.in","r",stdin);
    freopen("out.out","w",stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#endif
    int t = 1;
    cout.precision(20);
    if (t == -1)cin >> t;
    for (int i = 0; i < t; i++)solve();
}

