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

bool taken[N];

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

    vector<pii> lol;
    for(int i=0; i<n; i++)
        lol.pb({a[i], i});
    sort(lol.begin(), lol.end());

    vector<int> x, y;
    ll sx = 0, sy = 0;
    for(int i=n-1; i>=0; i--) {
        if(sx <= sy) {
            sx += lol[i].fi;
            x.pb(lol[i].sc);
        }
        else {
            sy += lol[i].fi;
            y.pb(lol[i].sc);
        }
    }

    if(sx < sy)
        swap(x, y);
    for(auto idk : x)
        ans.pb(idk);
    for(auto idk : y)
        ans.pb(idk);
    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