#include "partition.h"
#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define ff first
#define ss second
#define fr(i,ii,iii) for(int i=ii;i<iii;i++)
using namespace std;
std::vector<int> solve(std::vector<ll> A) {
	vi ans,ans1,ans2;
	int n=A.size();
	ll S=0;
	fr(i,0,n)S+=(ll)A[i];
	//cout<<S<<"\n";
	ll s;int x=0,c;bool ok;int mans=1e9;
	fr(mask,0,(1<<n)){
	//fr(mask,15,16){
		s=0;x=0;c=__builtin_popcount(mask);ok=1;ans1.clear();ans2.clear();
		fr(i,0,n){
			if((1<<i)&mask){//cout<<i<<" ";
				ans1.pb(i);
				x++;
				s+=A[i];
				if(s>=(S+1)/2){
					if(c!=x){
						ok=0;
						break;
					}
				}
			}
			else{
				ans2.pb(i);
			}
		}
		if(!ok)continue;
		if(s<(S+1)/2)continue;
		c=abs(n-2*c);
		if(c<mans){
			mans=c;
			ans.clear();
			for(auto i:ans1)ans.pb(i);
			for(auto i:ans2)ans.pb(i);
		}
	}
	return ans;
}
/*
int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t ;
    for (int test=1; test<=t; test++) {
        int n;
        cin >> n ;
        vector <ll> a(n);
        for (int i=0; i<n; i++) {
            cin >> a[i] ;
        }

        for (auto ind : solve(a)) {
            cout << ind << " ";
        }
        cout << endl ;
    }
    cout << endl ;
    return 0;
}
*/
/*
2
9
5 6 6 3 1 1 4 4 3
8
2 2 3 2 3 2 2 3
*/