#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second

vector<int> solve(vector<int> A) {
    vector <int> indx(A.size());
    vector <int> x;
    vector <int> y;
    for (int i=0; i<indx.size(); i++) indx[i]=i;
    ll a=0, b=0;
    
    for (int i=A.size()-1; i>-1; i--) {
        if (b<a) {
            y.push_back(indx[i]);
            b+=A[i];
        }
        else {
            x.push_back(indx[i]);
            a+=A[i];
        }
    }
    for (int i=0; i<y.size(); i++) {
        x.push_back(y[i]);
    }

    return x;
}

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;
}