#include <bits/stdc++.h>

using namespace std;

const int N = (int)3e5 + 9;

int ok(int x, vector < int > &a, vector < int > &c, long long &S) {
    vector < int > b;

    for (int i = x; i < (int)a.size(); i++) b.push_back(a[i]);
    for (int i = 0; i < x; i++) b.push_back(a[i]);

    long long su = 0, ind = 0;
    for (int i = 0; su < (S + 1) / 2; i++) su += c[b[i]], ind++;

    return (abs((int)a.size() - 2 * ind));
}

vector < int > solve(vector < int > c) {
    vector < int > a((int)c.size()); for (int i = 0; i < (int)c.size(); i++) a[i] = i;

    auto comp = [&](int i, int j) {
        return c[i] < c[j];
    };

    sort(a.begin(), a.end(), comp);

    long long mx = (int)1e18, n = (int)a.size(), S = accumulate(c.begin(), c.end(), 0ll);
    vector < int > ans = a;

    int l = 0, r = n;

    while (l + 2 < r) {
        int m1 = l + (r - l) / 3, m2 = r - (r - l) / 3;
        if (ok(m1, a, c, S) < ok(m2, a, c, S)) r = m2;
        else l = m1;
    }

    int ind = -1;
    for (int i = l; i <= r; i++) {
        if (ok(i, a, c, S) < mx) mx = ok(i, a, c, S), ind = i;
    }

    ans.clear();
    for (int i = ind; i < n; i++) ans.push_back(a[i]);
    for (int i = 0; i < ind; i++) ans.push_back(a[i]);

    return ans;
}