#include <bits/stdc++.h>
using namespace std;



std::vector<int> solve(std::vector<int> A) {

    std::vector<std::pair<int, int> > tempveci;
    vector<pair<int, int> > veci, veci2;

    int vkup1 = 0, vkup2 = 0;

    for (int i = 0; i<A.size(); i++) {
        tempveci.push_back({A[i], i});
    }

    sort(tempveci.begin(), tempveci.end());

    unordered_set<int> didIt;

    for (int i = 0; i<A.size(); i++) {
        if (vkup2>vkup1) {
            veci.push_back(tempveci[i]);
            vkup1 += tempveci[i].first;
        }
        else {
            veci2.push_back(tempveci[i]);
            vkup2 += tempveci[i].first;
        }
    }

    vector<int> final;

    for (int i = 0; i<veci.size(); i++) {
        final.push_back(veci[i].second);
    }
    for (int i = 0; i<veci2.size(); i++) {
        final.push_back(veci2[i].second);
    }

    return final;
}