#include <bits/stdc++.h>
using namespace std;
vector <int> ans;
int SS;
void perm(int tr, int N, float S, vector<int> A, vector<int> v, set<int> poz)
{
    if (tr == N)
    {
        int SSp = 0;
        vector <int> ansp;
        for (int i = 0; i < N; i++)
        {
            if (SSp < S/2) SSp += A[v[i]];
            ansp.push_back(v[i]);
        }
        if (SSp < SS)
        {
            ans = ansp;
            SS = SSp;
        }
        return;
    }
    for (int i = 0; i < N; i++)
    {
        if (poz.find(i) != poz.end()) continue;
        vector <int> vp = v;
        vp.push_back(i);
        set<int> pozp = poz;
        pozp.insert(i);
        perm(tr+1,N,S,A,vp,pozp);
    }
}
std::vector<int> solve(std::vector<int> A)
{
    ans.clear();
    int N = A.size();
    float S = 0;
    for (int i = 0; i < N; i++) S += A[i];
    SS = 0;
    for (int i = 0; i < N; i++)
    {
        if (SS < S/2) SS += A[i];
        ans.push_back(i);
    }
    vector <int> vpoc;
    set<int> pozpoc;
    perm(0,N,S,A,vpoc,pozpoc);
    return ans;
}