#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define pb push_back
#define pii pair<int,int>
typedef long long ll;


std::vector<int> solve(std::vector<int> A)
{
    int n=A.size();
    vector<int> v(n),w;
    ll s=0;
    for (int i=0;i<n;i++)
    {
        v[i]=i;
        s+=A[i];
    }
    s/=2;
    int b=1e9;
    vector<int> ans;
    do
    {
        ll sum=0;
        int i=0;
        while (sum<s)
        {
            sum+=A[v[i]];
            i++;
        }
        int c=abs(n-2*i);
        if (c<b)
        {
            b=c;
            w=v;
        }
    }
    while (next_permutation(v.begin(),v.end()));
    return w;
}
