#define rep(i, a, n) for (int i = a; i < n; ++i) #define per(i, a, n) for (int i = n - 1; i >= a; --i) #define pb push_back #define np next_permutation #define mp make_pair
constint maxn = 1e5 + 5;
ll a[maxn]; int n; intmain() { ios::sync_with_stdio(false); while (cin >> n) { rep(i, 0, n) cin >> a[i]; sort(a, a + n); for (int i = n - 1, j = 0;; i--, j++) { if (i == j) { cout << a[i] << endl; break; } if (i < j) break; cout << a[i] << endl << a[j] << endl; } // cout << endl; } }