#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> aa;
    int n = A.size();
    ll s = 0;
    for (auto to: A)
    {
        s += to;
        aa.pb({to, aa.size()});
    }
    sort(aa.begin(), aa.end());

    vector <pii> a = aa;
    int bst = 0;
    ll ss = 0;
    for (int i = 0; i < n; i++)
    {
        bst++;
        ss += a[i].F;
        if (ss >= (s + 1) / 2) break;
    }
    bst = max(bst, n - bst);
    for (int m = 0; m < (1ll << n); m++)
    {
        vector <pii> af;
        for (int j = 0; j < n; j++) if ((1 << j) & m) af.pb(aa[j]);
        for (int j = 0; j < n; j++) if (!((1 << j) & m)) af.pb(aa[j]);
        int b = 0;
        ll ss = 0;
        for (int i = 0; i < n; i++)
        {
            b++;
            ss += af[i].F;
            if (ss >= (s + 1) / 2) break;
        }
        if (max(b, n - b) < bst)
        {
            bst = max(b, n - b);
            a = af;
        }
    }

    vector <int> B;
    for (auto to: a) B.pb(to.S);
    return B;
}
