#include <bits/stdc++.h>

using namespace std;

std::vector<int> solve(std::vector<int> A) {
    int n = (int)A.size();
    vector<pair<int,int>> b;
    long long sum = 0;
    for (int i = 0; i < n; ++i) b.push_back({A[i], i}), sum += A[i];
    sort (begin (b), end (b));
    int cl = 0;
    long long sl = 0;
    int cr = 0;
    long long sr = 0;
    for (int i = 0; i < n; ++i) {
        sl += b[i].first;
        if (sl * 2 >= sum) break;
        ++cl;
    }
    reverse(begin (b), end (b));
    for (int i = 0; i < n; ++i) {
        sr += b[i].first;
        if (sr * 2 >= sum) break;
        ++cr;
    }
    int Targ = (n + 1) / 2;
    Targ = min (Targ, cl);
    Targ = max (Targ, cr);
//    cout << Targ << '\n';
    reverse (begin (b), end (b));
    for (int p_le = 0; p_le < Targ; ++p_le) {
        int p_ri = (n - (Targ - p_le) + 1 + 1);
        long long cs = 0;
        for (int i = 0; i <= p_le; ++i) cs += b[i].first;
        for (int i = p_ri; i < n; ++i) cs += b[i].first;
        if (cs * 2 >= sum) continue;
        for (int mid_val = p_le + 1; mid_val < p_ri; ++mid_val) {
            if ((cs + b[mid_val].first) * 2 >= sum) {
                vector<int> ans;

                for (int i = 0; i <= p_le; ++i) ans.push_back(b[i].second);
                ans.push_back(b[mid_val].second);
                for (int i = p_ri; i < n; ++i) ans.push_back(b[i].second);
                for (int i = p_le + 1; i < p_ri; ++i) {
                    if (i == mid_val) continue;
                    ans.push_back(b[i].second);
                }
//                for (auto it : ans) cout << A[it] << ' ';
//                cout << '\n';
                return ans;
            }
        }
    }

    vector<int> res (n);
    assert(0);
    return res;
}
#ifdef LOCAL
#include<iostream>
#include<vector>
using namespace std;
extern vector<int> solve(vector<int> A);
signed 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;
}

#endif // LOCAL
