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

const int NMAX = 1e2;
const int SMAX = 4e4;

using namespace std;

int dp[NMAX + 5][SMAX + 5];
array<int, 3> bck[NMAX + 5][SMAX + 5];
int a[NMAX + 5], viz[NMAX + 5], n;

std::vector<int> solve(std::vector<int> A) {
    n = (int)A.size();
    for (int i = 1; i <= n; ++i)
        a[i] = A[i - 1];
    int64_t S = accumulate(a + 1, a + n + 1, 0LL);

    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i){
        for (int used = i - 1; used >= 0; --used) {
            for (int sum = 0; sum <= S; ++sum) {
                if (dp[used][sum] == 0) continue;
                if (2 * sum >= S) continue;

                if (dp[used + 1][sum + a[i]] == 0 && dp[used][sum] == 1) {
                    dp[used + 1][sum + a[i]] = 1;
                    bck[used + 1][sum + a[i]] = {used, sum, i};
                }
            }
        }
    }

    pair<int, int> best = {0, 0};
    int best_dif = INT_MAX;
    for (int cate = 0; cate <= n; ++cate) {
        for (int sum = 0; sum <= S; ++sum) {
            if (dp[cate][sum] == 0) continue;
            if (2 * sum < S) continue;

            int martina = cate;
            int deni = n - cate;
            int dif = abs(martina - deni);
            if (dif < best_dif) {
                best_dif = dif;
                best = make_pair(cate, sum);
            }
        }
    }

    vector<int> ans;
    fill(viz + 1, viz + n + 1, 0LL);
    while (best.first > 0) {
        auto [new_used, new_sum, pos] = bck[best.first][best.second];
        ans.push_back(pos - 1);
        viz[pos] = true;
        best = {new_used, new_sum};
    }

    for (int i = 1; i <= n; ++i) {
        if (!viz[i])
            ans.push_back(i - 1);
    }

    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