#include <vector>
#include <iostream>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pi;
typedef long long ll;
typedef vector<pi> vpi;
#define x first
#define y second
#define fr(n) for(int i = 0; i<n; i++)

vi solve(vi a)
{
    int n = a.size();
    vpi v(n);
    ll s1 = 0, s2 = 0;
    fr(n){
        v[i] = {a[i],i};
        if(i<n/2)
            s1 += a[i];
        else
            s2 += a[i];
    }
    if(s1>s2){
        s1 = 0;
        s2 = 0;
        fr(n/2){
            pi p = v[i];
            v[i] = v[n-i-1];
            v[n-1-i] = p;
            s1 += v[i].x;
            s2 += v[n-i-1].x;
        }
        if(n%2)
            s2 += v[n/2].x;
    }
    int i = 0;
    for(;s1<s2 && i<n/2; i++){
        s2 += v[i].x-v[n-1-i].x;
        s1 += v[n-1-i].x-v[i].x;
        pi p = v[i];
        v[i] = v[n-1-i];
        v[n-i-1] = p;
    }
    i--;
    if(i>=0 && n/2-1>=0 && i<n) swap(v[n/2-1], v[i]);
    vi an(n);
    fr(n)
        an[i] = v[i].y;
    return an;
}