#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pii pair <int, int>
#define ld long double
#define ins insert
#define pb push_back
using namespace std;

const int N = 2e5 + 5;
const ll inf = 1e13;

std::vector<int> solve(std::vector<int> A)
{
    vector <pii> a;
    int n = A.size(), s = 0;
    for (auto to: A)
    {
        s += to;
        a.pb({to, a.size()});
    }
    sort(a.begin(), a.end());
    int s2 = 0;
    for (int i = 0; i < (n + 1) / 2; i++) s2 += a[i].F;
    for (int i = (n + 1) / 2 - 1; i >= 0; i--)
    {
        if (s2 >= (s + 1) / 2) break;
        s2 -= a[i].F;
        swap(a[i], a[n - ((n + 1) / 2 - i) - 1]);
        s2 += a[i].F;
    }
    vector <int> B;
    for (auto to: a) B.pb(to.S);
    return B;
}

//int32_t main()
//{
//    int t;
//    cin >> t;
//    while (t--)
//    {
//        int n;
//        cin >> n;
//        vector <int> a;
//        for (int i = 1; i <= n; i++)
//        {
//            int v;
//            cin >> v;
//            a.pb(v);
//        }
//        vector <int> ans = solve(a);
//        for (auto to: ans) cout << to << ' ';
//        cout << endl;
//
//    }
//    return 0;
//}
