#include "partition.h"
#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define ff first
#define ss second
#define fr(i,ii,iii) for(int i=ii;i<iii;i++)
using namespace std;
std::vector<int> solve(std::vector<int> A) {
	int n=A.size();ll S=0;
	pii a[n];
	fr(i,0,n){
		a[i]={A[i],i};
		S+=A[i];
	}
	sort(a,a+n);
	vi ans;
	fr(i,0,n)ans.pb(a[i].ss);
	int x=0;ll s=0;
	fr(i,0,(n+1)/2){
		s+=a[i].ff;
	}
	while(s<=(S-1)/2 and x<(n+1)/2){
		//cout<<s<<" "<<(S-1)/2<<"\n";
		s-=a[x].ff;s+=a[n-x-1].ff;
		swap(ans[x],ans[n-x-1]);
		x++;
	}//cout<<s;
	return ans;
}

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

/*
2
9
5 6 6 3 1 1 4 4 3
8
2 2 3 2 3 2 2 3
*/