#include "bits/stdc++.h"
#include "partition.h"
// #include "grader.cpp"

using namespace std;

#define SZ(s) (int)s.size()
#define ll long long
#define ff first
#define ss second

vector<int> solve(vector<int> a) {
    int n = SZ(a);
    ll s = 0;
    vector <pair <int, int>> v;
    vector <int> p, b;
    for(int i = 0; i < n; i++) {
        b.push_back(i);
        s += a[i];
        v.push_back({a[i], i});
    }
    int mn = 1e9;
    do {
        ll sm = 0;
        int cnt = 0;
        for(int i = 0; i < n; i++) {
            if(sm * 2 >= s) break;
            sm += (a[b[i]]);
            cnt++;
        }
        if(abs((n - cnt) - cnt) < mn) {
            mn = abs((n - cnt) - cnt);
            p = b;
        }
    } while(next_permutation(b.begin(), b.end()));
    // cout << mn << '\n';
    return p;
}
