#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
#define ll long long
std::vector<int> solve(std::vector<int> A)
{
    vector<int> ind;
    for(int i = 0; i < A.size(); i++)
        ind.push_back(i);
    vector<int> rez;
    int difmin = A.size() + 5;
    long long s, cnt;
    int difer, lenfirst, lensecond;
    do{
        s = 0;
        for(int i = 0; i < ind.size(); i++)
            s += A[ind[i]];
        s = (s / 2 + s % 2);
        lenfirst = 0;
        cnt = 0;
        for(int i = 0; i < ind.size(); i++)
        {
            lenfirst++;
            cnt += A[ind[i]];
            if(cnt >= s)
                break;
        }
        lensecond = A.size() - lenfirst;
        difer = abs(lenfirst - lensecond);
        if(difer < difmin)
            difmin = difer, rez = ind;
    }while(next_permutation(ind.begin(), ind.end()));
    return rez;
    /*vector<int> st, dr;
    int last = 0;
    if(A.size() == 2)
    {
        st.push_back(1);
        st.push_back(0);
        return st;
    }
    for(int i = 0; i < A.size() / 2; i++)
    {
        if(i % 2 == 0)
        {
            st.push_back(i);
            st.push_back(A.size() - i - 1);
            last = 1;
        }
        else
        {
            dr.push_back(i);
            dr.push_back(A.size() - i - 1);
            last = 0;
        }
    }
    if(last && A.size() % 2)
        dr.push_back(A.size() / 2);
    if(!last && A.size() % 2)
        st.push_back(A.size() / 2);
    for(auto it : dr)
        st.push_back(it);
    return st;*/
}
