#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

vector<int> dp;
vector<int> arr;

int makeDp(int sub){
    if(dp[sub] != -1) return dp[sub];
    if(sub == 0) return 0;
    int i = 0;
    while(!(sub&(1<<i))) i++;
    return dp[sub] = makeDp(sub^(1<<i)) + arr[i];
}

vector<int> solve(vector<int> A){
    arr = A;
    int sum = 0;
    for(auto i : A) sum += i;
    sum /=2;
    dp.assign((1<<(A.size()+1)), -1);
    int tpow = (1<<(A.size()+1));

    pair<int, int> best = {2000000000, -1};
    for(int i = 0; i<tpow; i++){
        if((makeDp(i)>sum) && ((makeDp(i)-sum)<best.first)) best = {makeDp(i)-sum, i};
    }

    vector<int> ans;
    
    for(int i = 0; i<A.size(); i ++){
        if((1<<i) & best.second) ans.push_back(i);
    }
    for(int i = 0; i<A.size(); i ++){
        if(!((1<<i) & best.second)) ans.push_back(i);
    }

    return ans;
}