#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
std::vector<int> solve(std::vector<int> A) {
    int n = A.size();
    int l = n / 2, r = l;
    if (n & 1) {
        r++;
    }
    vector<int> ans;
    long long s = 0;
    vector<pair<long long, int>> f;
    for (int i = 0; i < n; ++i) {
        f.push_back({A[i], i});
        s += A[i];
    }
    if (!is_sorted(A.begin(), A.end())) {
        sort(f.begin(), f.end());
    }
    vector<long long> pref(n);
    vector<bool> can;
    pref[0] = A[0];
    for (int i = 0; i < n; ++i) {
        pref[i] = pref[i - 1] + f[i].first;
        if (2 * pref[i] < s || 2 * (pref[i] - f[i].first) < s) can.push_back(true);
        else can.push_back(false);
    }
    while (true) {
        int k;
        if (abs(l - n + l) < abs(r - n + r)) k = l, l--;
        else k = r, r++;
        long long sum = pref[k - 1];
        if (2 * sum < s) {
            int l = 1, r = min(k, n - k);
            while (true) {
                if (l >= r) break;
                int mid = (l + r) >> 1;
                if (2 * (sum - pref[mid - 1] + s - pref[n - mid - 1]) >= s) r = mid;
                else l = mid + 1;
            }
            vector<bool> used(n);
            for (int i = l; i < k; ++i) ans.push_back(f[i].second);
            for (int i = n - l; i < n; ++i) ans.push_back(f[i].second);
            for (auto &i : ans) used[i] = true;
            for (int i = 0; i < n; ++i) {
                if (!used[i]) ans.push_back(i);
            }
            return ans;
        } else {
            if (can[k - 1]) {
                for (auto [val, idx] : f) ans.push_back(idx);
                return ans;
            }
        }
    }
    return ans;
}