#include <bits/stdc++.h>

using namespace std;
using ll = long long;

vector<int> solve(vector<int> A) {
    int n = A.size();
    vector<int> ord(n);
    iota(ord.begin(), ord.end(), 0);
    sort(ord.begin(), ord.end(), [&](int x, int y) {
        return A[x] < A[y];
    });
    ll sum = 0;
    for (int i = 0; i < n; ++i) {
        sum += A[i];
    }
    ll s = sum;
    int pA = n, pB = 0;
    int ans = 1e9;
    vector<int> sol;
    for (int l = 0; l < n; ++l) {
        for (int r = l; r < n; ++r) {
            ll s = 0;
            bool ok = true;
            for (int k = l; k <= r; ++k) {
                if (s >= (sum + 1) / 2) {
                    ok = false;
                    break;
                }
                s += A[ord[k]];
            }
            if (!ok) continue;
            int x = r - l + 1;
            int y = n - x;
            if (s >= (sum + 1) / 2) {
                if (ans > abs(x - y)) {
                    ans = abs(x - y);
                    sol.clear();
                    for (int k = l; k <= r; ++k) {
                        sol.push_back(ord[k]);
                    }
                }
            }
        }
    }
    // cout << "! " << ans << "\n";
    vector<int> taken(n);
    for (auto x : sol) taken[x] = 1;
    for (int i = 0; i < n; ++i) if (!taken[i]) sol.push_back(i);
    return sol;
}

/*
8
2 2 3 2 3 2 2 3
X X   X   X X
6 5 3 1 0 2 4 7 


*/
