#include <bits/stdc++.h>

// #ifndef DEVAL
// #include "grader2.cpp"
// #endif

#define ll long long

using namespace std;

struct Element {
    int val;
    int index;

    bool operator<(const Element& other) {
        return val < other.val;
    }
};

std::vector<int> solve(std::vector<int> A) {
    ll su = 0;

    vector<Element> elements(A.size());

    for (int i = 0; i < A.size(); ++i) {
        elements[i].index = i;
        elements[i].val = A[i];
    }

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

    vector<ll> subsetsum(A.size());

    for (int i = 0; i < A.size(); ++i) {
        subsetsum[i] = su;
        su += elements[i].val;
    }

    ll max_to_use = (su - 1) / 2;

    ll elm_to_use = (A.size() - 1) / 2;

    vector<int> left;
    left.reserve((A.size() + 1) / 2);
    vector<int> right;
    right.reserve((A.size() + 1) / 2);

    for (int i = A.size() - 2; i >= elm_to_use; --i) {
        if ((elm_to_use >= 1) && (max_to_use >= elements[i].val + subsetsum[elm_to_use - 1])) {
            max_to_use -= elements[i].val;
            --elm_to_use;
            left.push_back(elements[i].index);
        } else {
            right.push_back(elements[i].index);
        }
    }

    for (int i = 0; i < elm_to_use; ++i) {
        left.push_back(elements[i].index);
    }

    vector<int> sol;
    sol.reserve(A.size());

    for (int &elm : left) {
        sol.push_back(elm);
    }

    sol.push_back(elements[A.size() - 1].index);

    for (int& elm : right) {
        sol.push_back(elm);
    }
    
    assert(A.size() <= 100'000);

    return sol;
}