#include <bits/stdc++.h>

#define pb push_back
#define fi first
#define sc second

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int N = 2e6 + 5;
const ll inf = 1e16;

bool taken[N];
vector<int> ans;

vector<int> solve(vector<int> a) {
    ans.clear();
    int n = a.size();

    ll mindiff = inf, bstmask = -1;
    for(int mask=0; mask<(1<<n); mask++) {
        ll s1 = 0, s0 = 0;
        for(int p=0; p<n; p++) {
            if(mask & (1 << p))
                s1 += a[p];
            else
                s0 += a[p];
        }

        if(s1 >= s0 && s1 - s0 < mindiff) {
            mindiff = s1 - s0;
            bstmask = mask;
        }
    }
    for(int i=0; i<n; i++)
        if((1 << i) & bstmask)
            ans.pb(i);
    for(int i=0; i<n; i++)
        if(!((1 << i) & bstmask))
            ans.pb(i);
    
    return ans;

    /*
    int i;
    for(i=n-1; i>=3; i-=4) {
        ans.pb(i);
        ans.pb(i-3);
        taken[i] = taken[i-3] = 1;
    }
    if(i == 2) {
        ans.pb(2);
        taken[2] = 1;
    }
    else if(i == 1) {
        ans.pb(1);
        taken[1] = 1;
    }
    else {
        ans.pb(0);
        taken[0] = 1;
    }
    for(int i=0; i<n; i++) {
        if(!taken[i])
            ans.pb(i);
        else
            taken[i] = 0;
    }

    return ans;*/
}

#ifndef EVAL
int32_t main() {
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
    cin.tie(nullptr)->sync_with_stdio(0);

    int tt;
    cin >> tt;
    while(tt--) {
        vector<int> a;
        int n;
        cin >> n;
        for(int i=1; i<=n; i++) {
            int x;
            cin >> x;
            a.pb(x);
        }

        vector<int> res = solve(a);
        for(auto x : res)
            cout << x << ' ';
        cout << '\n';
    }
    return 0;
}
#endif