#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctype.h>
#include <assert.h>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define endl '\n'

using namespace std;
using namespace __gnu_pbds;

template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

#include "partition.h"

vector<int> solve(vector<int> A) {
    vector<pair<int,int>> a;
    vector<pair<int,int>> ans;
    for(int i = 0; i < A.size(); i++) a.push_back({A[i], i});
    int b = 1e9;
    int s=0;
    for(auto x : A) s+=x;
    //cout << s << endl;
    sort(a.begin(), a.end());
    do {
        int sum=0;
        for(int i = 0; i < a.size(); i++) {
            sum+=a[i].first;
            if(sum>=s/2+s%2) {
                int curr = (i+1)-(a.size()-(i+1)); curr=abs(curr);
                if(curr<b) {
                    //cout << sum << " " << s/2 << endl;
                    b=curr;
                    ans=a;
                    break;
                }
            }
        }
    } while(next_permutation(a.begin(), a.end()));
    //cout << b << endl;
    vector<int> ret;
    for(auto x : ans) ret.push_back(x.second);
    return ret;
}
/*
1
9
5 6 6 3 1 1 4 4 3
*/
