#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

vector<int> solve(vector<int> A)
{
    int n = A.size();
    vector<pair<ll,ll>> B;
    for (int i = 0; i < n; i++)
    {
        B.push_back({A[i], i});
    }
    sort(B.begin(), B.end());
    vector<ll> prefix(n+1, 0), suffix(n+1, 0);
    for (int i = 0; i < n; i++)
    {
        prefix[i+1] = prefix[i]+B[i].first;
    }
    for (int i = n - 1; i >= 0; i--)
    {
        suffix[i] = suffix[i+1]+B[i].first;
    }
    ll sum = accumulate(A.begin(), A.end(), 0ll);
    for (int k = n/2; k<n; k++)
    {
        for (int i = 0; i < k; i++)
        {
            if (prefix[i]+suffix[n-k+i] >= sum/2 && prefix[i]+suffix[n-1-i]-B.back().first < sum/2)
            {
                vector<int> ans;
                for (int j = 1; j <= i; j++)
                {
                    ans.push_back(B[j-1].second);
                }
                for (int j = n-k+i; j < n; j++)
                {
                    ans.push_back(B[j].second);
                }
                for (int j = i; j < n-k+i; j++)
                {
                    ans.push_back(B[j].second);
                }
                return ans;
            }
            else if (prefix[i]+suffix[n-k+i] < sum/2)
            {
                break;
            }
        }
    }
    return vector<int>();
}

#ifdef DEBUG
int main () {
    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
