#include <bits/stdc++.h>

using namespace std;

const int N = (int)3e5 + 9;

vector < int > solve(vector < int > a) {
    sort(a.begin(), a.end());

    long long mx = (int)1e18, n = (int)a.size(), S = accumulate(a.begin(), a.end(), 0ll);
    vector < int > ans = a;

    for (int q = 1; q <= n + 2; q++) {
        long long su = 0, ind = 0;
        for (int i = 0; su < S / 2; i++) su += a[i], ind++;
        if (mx > abs(n - 2 * ind)) {
            mx = min(mx, abs(n - 2 * ind));
            ans = a;
        }

        vector < int > b;
        for (int i = 1; i < n; i++) b.push_back(a[i]); b.push_back(a[0]);
        a = b;
    }

    return ans;
}