#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

std::vector<int> solve(std::vector <int> a){
    vector <pair <ll,ll> > b;
    ll n = a.size();
    ll sum = 0;
    for (int i = 0; i < a.size(); i++){
         b.push_back({a[i], i});
         sum += a[i];
    }
    sort(b.begin(), b.end());
    reverse(b.begin(), b.end());
    ll so =10e12;
    vector <int> perm;
    for (int i = 0; i < n; i++){
        vector <ll> p;
        vector <ll> p1;
        ll s = 0, s1 = 0;
        for (int j = 0; j < n; j++){
            if(i == j) continue;
            if(p.size() == p1.size()){
                if(2*(s + b[j].first) < sum)
                {
                    p.push_back(b[j].second);
                    s += b[j].first;
                }
                else {
                    s1 += b[j].first;
                    p1.push_back(b[j].second);
                }
            }
            else {
                if(2*(s1 + b[j].first) < sum)
                {
                    p1.push_back(b[j].second);
                    s1 += b[j].first;
                }
                else {
                    s += b[j].first;
                    p.push_back(b[j].second);
                }
            }
        }
        if(abs(ll(p.size()) - ll(p1.size())) < so && 2*s < sum && 2*s1 < sum){
            so = abs(ll(p.size()) - ll(p1.size()));
            if(p.size() < p1.size())
                swap(p, p1);
            vector <int> now;
            for (int j = 0; j < p.size(); j++)
                now.push_back(p[j]);
            now.push_back(b[i].second);
            for (auto u : p1)
                now.push_back(u);
            perm = now;
        }
    }
   // cout << so << endl;
    return perm;
}