#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<numeric>
#include<functional>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<bit>

using namespace std;
//#define int long long
#define pii pair<int, int>
#define ll long long
#define ull unsigned ll
#define pll pair<ll, ll>
#define ve vector
#define vi ve<int>
#define vvi ve<vi>
#define vll ve<ll>
#define tiii tuple<int, int, int>
#define tiiii tuple<int, int, int, int>
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a= max(a, b)
#define all(a) a.begin(), a.end()
#define for0(i, n) for(int i= 0; i < n; ++i)
#define allr(a) a.rbegin(), a.rend()
extern vector<int> solve(vector<int> A) {
    int n = A.size();
    ve<pii> a(n);

    for (int i = 0; i < n; ++i) {
        a[i] = { A[i], i };
    }
    int mx = max_element(all(a)) - a.begin();
    sort(allr(a));
    vi ans1, ans2;
    int sm1 = 0, sm2 = 0;
    for (int i = 1; i < n; ++i) {
        if (sm1 < sm2) {
            ans1.push_back(a[i].second);
            sm1 += a[i].first;
        }

        else {
            ans2.push_back(a[i].second);
            sm2 += a[i].first;
        }
    }
    if (sm1 < sm2) {
        ans1.push_back(mx);
        for (auto now : ans2) ans1.push_back(now);
        return ans1;
    }
    else {
        ans2.push_back(mx);
        for (auto now : ans1) ans2.push_back(now);
        return ans2;
    }
    
}