#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")

using namespace std;

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

vector < int > solve(vector < int > c) {
    int a[(int)c.size() * 2 + 4];

    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, a + (int)c.size(), comp);
    for (int i = 0; i < (int)c.size(); i++) a[(int)c.size() + i] = a[i];

    int mx = (int)1e18, n = (int)c.size();
    long long S = accumulate(c.begin(), c.end(), 0ll), e = 0;

    long long su = 0, ind = 0;

    for (int q = 0; q <= n / 2 + 1; q++) {
        while (su < (S + 1) / 2) su += c[a[ind]], ind++;
        int ee = abs(n - 2 * (ind - q));

        if (mx >= ee) {
            mx = ee;
            e = q;

            if (ee == (n & 1)) break;
        } else break;

        su -= c[a[q]];
    }

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

    return ans;
}
