# include "partition.h"
# include <bits/stdc++.h>
# define ll long long
using namespace std;

const int MAXN = 2 * 1e6 + 1;
int n;

vector<int> solve(vector<int> a)
{
    n = (int)a.size();
    vector<int> answer;
    int difference = n + 1;
    vector<int> perm;
    for(int i = 0; i < n; i++) perm.push_back(i);
    ll sum = 0;

    do
    {
        ll current = 0;
        int index;
        while(index < n)
        {
            current += a[perm[index]];
            if(2 * current >= sum) break;
            index++;
        }

        int diff = abs(n - 2 *(n - (index)));
        if(diff < difference)
        {
            difference = diff;
            answer = perm;
        }
    }
    while(next_permutation(perm.begin(), perm.end()));

    return answer;
}
