#include "partition.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <deque>
#include <math.h>
#include <array>
#include <set>
#include <string>

#define rep(i, s, e) for (ll i = s; i < e; i++)
#define upmax(a, b) a = max(a, b)
#define upmin(a, b) a = min(a, b)

using namespace std;
using ll = int;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;

const ll INF = 1e18;

vector<int> solve(vector<int> A) {
    ll n = A.size();
    /*vpll arr(n);
    double sum = 0;
    rep(i, 0, n) {
        arr[i] = { A[i], i };
        sum += (double)A[i];
    }
    sum /= 2;*/
    ll left = (n + 3) / 4;
    vector<int> ans(n);
    ll pos = 0;
    rep(i, left, left + n / 2) {
        ans[pos] = i;
        pos++;
    }
    rep(i, 0, left) {
        ans[pos] = i;
        pos++;
    }
    rep(i, left + n / 2, n) {
        ans[pos] = i;
        pos++;
    }
    return ans;
    /*ll left = 0, right = -1;
    long long cur_sum = 0;
    ll best_dif = 0;
    if (n % 2 == 1) best_dif = 1;
    while (right < n - 1) {
        if (cur_sum >= sum) {
            break;
        }
        right++;
        ll val = arr[right].first;
        ll idx = arr[right].second;
        cur_sum += val;
        if (right - left + 1 - (n - (right - left + 1)) == best_dif) {
            if (cur_sum >= sum) break;
            cur_sum -= arr[left].first;
            left++;
        }
    }
    vector<int> ans(n);
    ll pos = 0;
    rep(i, left, right + 1) {
        ans[pos] = arr[i].second;
        pos++;
    }
    rep(i, 0, left) {
        ans[pos] = arr[i].second;
        pos++;
    }
    rep(i, right + 1, n) {
        ans[pos] = arr[i].second;
        pos++;
    }
    return ans;*/
}
