
// Author:: PRIYANSHU SHARMA
// Institution:: Indian Institute of Technology Ropar

#include<bits/stdc++.h>
#include <algorithm>

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define endln cerr << "\n";
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,b) for(int i=a-1;i>=b;i--)


mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif
}
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}
int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n

const int N = 10000000;
int lp[N + 1];
vector<int> pr;

void prime(vector<int> &pr, int *lp)
{
    for (int i = 2; i <= N; ++i) {
        if (lp[i] == 0) {
            lp[i] = i;
            pr.push_back (i);
        }
        for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] <= N; ++j)
            lp[i * pr[j]] = pr[j];
    }
    return;
}

/*-------------------------=-----------------SOLUTION-----------------------------------------------*/

//#define fr(i,a,b) for(int i=a;i<b;i++)

bool rearrange(pii a, pii b)
{
    /*
        We can send the value x into
        lambda expression as
        follows: [capture]()
        {
            //statements
            //capture value can be used inside
        }
    */

    if ((a.ff - a.ss) < (b.ff - b.ss))
        return true;
    else
        return false;

}
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

// Returns LCM of array elements
int findlcm(int arr[], int n)
{
    // Initialize result
    int ans = arr[0];

    // ans contains LCM of arr[0], ..arr[i]
    // after i'th iteration,
    for (int i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
               (gcd(arr[i], ans)));

    return ans;
}
unsigned int nextPowerOf2(unsigned int n)
{
    unsigned count = 0;

    // First n in the below condition
    // is for the case where n is 0
    if (n && !(n & (n - 1)))
        return n;

    while ( n != 0)
    {
        n >>= 1;
        count += 1;
    }

    return 1 << count;
}
int32_t main()
{

    c_p_c();


    //prime(pr,lp);



    int n;
    cin >> n;
    mk(arr, n * n, int);
    fr(i, 0, n * n)
    {
        cin >> arr[i];
    }
    vector<int> v(n);
    sort(arr, arr + n * n);

    //v[n-1]=arr[n*n-1];
    int j = n - 1;
    int i = n * n - 1;
    int lvl = 1;
    while (i >= 0)
    {
        int x = 2 * lvl - 1;
        int t = arr[i];
        //cout << i << " " ;
        v[j--] = t;
        while (x)
        {
            i--;
            x--;
        }
        lvl++;
    }
    //cout << endl;
    fr(i, 0, n)
    {
        cout << v[i] << " ";
    }




}


























