// slojih si krila i zapochnah da letq

#include<iostream>
#include<vector>
#include <math.h>
#include <algorithm>
#include <numeric>
//#define DEBUG
#ifndef DEBUG
#include "partition.h"
#endif // DEBUG

std::vector<int> solve(std::vector<int> A) {
    int mx = 0, mn = 1e6;
    for (int i = 0 ; i < A.size(); i++) {
        mx = std::max(A[i], mx);
        mn = std::min(A[i], mn);
    }

    std::vector<std::pair<int, int>> og;
    for (int i = 0; i < A.size(); i++) {
        og.push_back(std::make_pair(A[i], i));
    }

    std::sort(og.begin(), og.end());


    int sum = accumulate(A.begin(), A.end(), 0);
    int avg = std::ceil(float(sum) / float(A.size()));
    int goal = std::ceil(sum / 2); // tova moje i da trqbva da e ceiling
    int diff = 0;
    std::vector<int> path;
    while (sum > goal) {
        auto x = std::lower_bound(og.begin(), og.end(), avg - diff,
            [](const std::pair<int, int>& info, int value)
            {
                return info.first < value;
            });
        //std::cout << x->first;
        if (x == og.end()) {
            x = std::lower_bound(og.begin(), og.end(), avg - diff,
            [](const std::pair<int, int>& info, int value)
            {
                return info.first < value;
            }) - 1;
        }


        //std::cout << "i" << std::distance(og.begin(), x) << std::endl;
                //std::cout << "d" << avg - diff << std::endl;

        diff = diff + (x->first - avg);
        //? std::cout << *lower << " at index " << std::distance(data.begin(), lower)
        path.push_back(x->second);
        sum -= x->first;
        og.erase(x);

        // ok sega idva problemut che az ne znam kak da implementiram tva s kude se namira toq index...

        //A[std::distance(A.begin(), x)] = INF;
    }

    for (auto [x, y] : og) {
        path.push_back(y);
    }

    return path;
}
#ifdef DEBUG

int main () {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    int t;
    std::cin >> t ;
    for (int test=1; test<=t; test++) {
        int n;
        std::cin >> n ;
        std::vector <int> a(n);
        for (int i=0; i<n; i++) {
            std::cin >> a[i] ;
        }

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

#endif