#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 = A.size();
    int S = accumulate(A.begin(), A.end(), 0LL);

    vector<int> p(n);
    iota(p.begin(), p.end(), 0);
    vector<int> best;
    int best_dif = INT_MAX;

    do {
        int sum = 0, cnt = 0;
        for (int i = 0; i < n; ++i) {
            sum += A[p[i]];
            ++cnt;
            if (2 * sum >= S)
                break;
        }

        int oth = n - cnt;
        int dif = abs(cnt - oth);
        if (dif < best_dif) {
            best = p;
            best_dif = dif;
        }

    }while (next_permutation(p.begin(), p.end()));

    return best;
}

#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