#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];
int lg2[1<<20], mx[1<<20];
ll sum[1<<20];

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

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

    priority_queue<int, vector<int>, greater<int>> que;
    int lmao = n - 1;
    while(lmao >= 0 && crt < s / 2.0) {
        que.push(lol[lmao].fi);
        crt += lol[lmao].fi;
        lmao--;
    }
    
    crt = 0;
    int moved = 0;
    for(int i=0; i<lmao; i++) {
        crt += lol[i].fi;
        if(crt > que.top()) {
            crt -= que.top();
            moved++;
            que.pop();
        }

        if(i + que.size() + 1 >= n / 2) {
            for(int j=0; j<=i; j++)
                ans.pb(lol[j].sc);
            for(int j=n-1; j>=n-que.size(); j--)
                ans.pb(lol[j].sc);
            for(int j=i+1; j<n-que.size(); j++)
                ans.pb(lol[j].sc);
            return ans;
        }
    }

    return {0};
}

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

        //assert(abs(pax-(n-pax)) <= 1);
        for(auto x : res)
            cout << x << ' ';
        cout << '\n';

    }
    return 0;
}
#endif