#include "partition.h"
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <set>
#include <cmath>

#define ll long long
#define sz size()
#define cY cout << "YES" << endl;
#define cN cout << "NO" << endl;
#define pb push_back
#define F first
#define S second
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

/*
"0.000..."   setprecision(---) + fixed
"USACO"      freopen("---", "r", stdin); freopen("---", "w", stdout);
"Matrix"     vector <vector <int>> ---(---, vector <int> (---));
"NOD"        __gcd
"NOK"        a * b / __gcd(a,b)
*/

using namespace std;

std::vector<int> solve(std::vector<int> A) {
    ll n = A.sz;
    vector <vector <int>> a(n, vector <int> (3));
    for (int i = 0; i < n; i++) {
        a[i][2] = i;
        a[i][1] = A[i];
    }

    sort(a.rbegin(), a.rend());
    ll sum1 = 0, sum2 = 0;
    for (int i = 0; i < a.sz; i++) {
        if (sum1 <= sum2) {
            a[i][0] = 1;
            sum1 += a[i][1];
        }
        else {
            a[i][0] = 2;
            sum2 += a[i][1];
        }
    }

    vector <int> V;
    sort(a.begin(), a.end());
    for (int i = 0; i < n; i++) {
        V.pb(a[i][2]);
    }

    return V;
}