#include <bits/stdc++.h>

using namespace std;
int get (vector<int> ans, vector<int> A, long long s) {
    long long cr = 0;
    for (int i = 0; i < (int)ans.size(); ++i) {
        cr += A[ans[i]];
        if (cr * 2 >= s) return i + 1;
    }
}
mt19937_64 rng (time (0));
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;
        ++cl;
        if (sl * 2 >= sum) break;
    }
    reverse(begin (b), end (b));
    for (int i = 0; i < n; ++i) {
        sr += b[i].first;
        ++cr;
        if (sr * 2 >= sum) break;
    }
    int Targ = (n + 1) / 2;
    Targ = min (Targ, cl);
    Targ = max (Targ, cr);

    reverse (begin (b), end (b));
    vector<long long> P(n + 1);
    for (int i = 0; i < n; ++i) P[i] = (i == 0 ? 0 : P[i - 1]) + b[i].first;
//    cout << "ABABACA" << endl;;
    for (int p_le = 0; p_le < Targ; ++p_le) {
        int p_ri = p_le + 1 + n - Targ + 1;
        if (p_ri > n) {
            if (P[p_le] * 2 >= sum && (P[p_le] - A[p_le]) * 2 < sum) {
                vector<int> ans (n);
                iota (begin (ans), end (ans), 0);
                return ans;
            } else continue;
        }
        long long cs = P[p_le] + (p_ri == n ? 0 : P[n - 1] - (p_ri == 0 ? 0 : P[p_ri - 1]));
        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);
                }
                if (get (ans, A, sum) != Targ) assert(0);
                return ans;
            }
        }
    }

    vector<int> res;
    --Targ;
    long long cs = 0;
    int pos_id = 0;
    for (int i = n - Targ; i < n; ++i) res.push_back(b[i].second), cs += b[i].first;
    for (int i = 0; i < n - Targ; ++i) {
        if ((cs + b[i].first) * 2 >= sum) {
            res.push_back(b[i].second);
            pos_id = i;
            break;
        }
    }
    for (int i = 0; i < n - Targ; ++i) {
        if (i == pos_id) continue;
        res.push_back(b[i].second);
    }


    if (get (res, A, sum) != Targ) {
        assert(0);s
    }
    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 ;
//    t = 1;
    for (int test=1; test<=t; test++) {
        int n;
        cin >> n ;
//        n = rng() % 7 + 1;
        vector <int> a(n);
        for (int i=0; i<n; i++) {
            cin >> a[i] ;
//            a[i] = (rng () % 10) + 1;
        }

        for (auto ind : solve(a)) {
            cout << ind << " ";
        }
        cout << endl ;
    }
    cout << endl ;
    return 0;
}

#endif // LOCAL
