#include <bits/stdc++.h>
#include "partition.h"

const int NMAX = 25;

using namespace std;

vector<int> prec[NMAX + 5];
int n;

std::vector<int> solve(std::vector<int> A) {
    n = (int)A.size();
    int64_t S = accumulate(A.begin(), A.end(), 0LL);

    if (!prec[n].empty())
        return prec[n];

    vector<int> p1;
    int best_msk = -1, best_dif = INT_MAX;
    for (int msk = 0; msk < (1LL << n); ++msk) {
        int64_t sum = 0;
        int cnt = 0;
        for (int i = 0; i < n; ++i) {
            if ((msk & (1LL << i))) {
                sum += A[i];
                ++cnt;
            }

            if (2 * sum >= S)
                break;
        }

        if (cnt != __builtin_popcountll(msk)) continue;

        int martina = __builtin_popcountll(msk);
        int deni = n - martina;
        int dif = abs(martina - deni);
        if (2 * sum >= S && dif < best_dif) {
            best_msk = msk;
            best_dif = dif;
        }
    }

    vector<int> ans;
    for (int i = 0; i < n; ++i) {
        if ((best_msk & (1LL << i)))
            ans.push_back(i);
    }

    for (int i = 0; i < n; ++i) {
        if (!(best_msk & (1LL << i)))
            ans.push_back(i);
    }

    prec[n] = ans;
    return ans;
}

#ifndef EVAL
#include<iostream>
#include<vector>
using namespace std;
extern vector<int> solve(vector<int> A);
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 <int> 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;
}
#endif