#include <bits/stdc++.h>

using namespace std;

vector <int> solve ( vector <int> A ) {
    vector <int> ans = {};
    int fv[30000001];
    for ( int i = 0; i < 30000001; i++ ) {
        fv[i] = 0;
    }
    for ( auto it: A ) {
        fv[it]++;
    }
    for ( int i = 0; i < 30000001; i++ ) {
        for ( int j = 1; j <= fv[i]/2; j++ ) {
            ans.push_back (i);
        }
    }
    for ( int i = 0; i < 30000001; i++ ) {
        for ( int j = 1; j <= fv[i]/2; j++ ) {
            ans.push_back (i);
        }
    }
    for ( auto it: ans ) {
        cout << it << ' ';
    }

    return ans;
}