#include <bits/stdc++.h>
using namespace std;

int total_candies=0, n;
vector<pair<int, int>> reordered;

vector<int> solve(vector<int> &A) {
    vector<int> sol(n);
    int min_diff=INT_MAX;

    do {
        int d=0, packs;
        for (packs=0; d<total_candies/2; packs++) d+=reordered[packs].first;
        if (abs((n-packs)-packs)<min_diff) {
            min_diff=abs((n-packs)-packs);
            for (int i=0; i<n; i++) sol[i]=reordered[i].second;
        }
    }while (next_permutation(reordered.begin(), reordered.end()));

    return sol;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;

    vector<int> A;

    for (int i=0; i<t; i++) {
        cin >> n;
        A.resize(n);
        reordered.resize(n);
        for (int j=0; j<n; j++) {
            cin >> A[j];
            total_candies+=A[j];
            reordered.push_back({A[j], j});
        }

        vector<int> ans=solve(A);
        for (int a: ans) cout << a << " ";
        cout << '\n';
    }


    return 0;
}