#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> v;
typedef vector<v> vv;
typedef vector<vv> vvv;
typedef pair<ll, ll> p;
typedef vector<p> vp;
typedef vector<vp> vvp;
typedef vector<vvp> vvvp;
typedef pair<ll, p> tri;
typedef vector<tri> vtri;
typedef vector<vtri> vvtri;
typedef vector<vvtri> vvvtri;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vvb> vvvb;

#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()

const ll INF = 1e18;
const ll mod = 1e9 + 7;

std::vector<int> solve(std::vector<int> A)
{
    ll N = A.size();
    vp nums;
    for (ll i = 0; i < N; i++) nums.eb(A[i], i);
    sort(all(nums));
    ll S = 0;
    ll len = (N + 1) / 2;
    for (ll i = 0; i < N; i++) S += A[i];
    ll threshold = (S + 1) / 2;
    ll half = 0;
    for (ll i = 0; i < len; i++)
    {
        half += nums[i].f;
    }
    ll i = len, j = N - 1;
    while (half < threshold)
    {
        half -= nums[i].f;
        half += nums[j].f;
        swap(nums[i], nums[j]);
        i--; j--;
    }
    vector<int> perm;
    for (ll i = 0; i < N; i++) perm.pb(nums[i].s);
    return perm;
}