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

#define speedup cin.tie(0) -> sync_with_stdio(0)
#define all(x) begin(x), end(x)
#define pb push_back
#define vc vector

using ll = long long;
template<class T> bool chmin(T &a, T b) {if (a > b) {a = b; return 1;} return 0;}
vc<int> solve(vc<int> a) {
    ll s = accumulate(all(a), 0ll);
	int n = a.size();
    vc<int> p (n);
    iota(all(p), 0);

    vc<int> ansv;
    ll ans = s, t = (s + 1) / 2;
	do {
		ll sum = 0;
		for (int i = 0; i < n; i++) {
			sum += 1ll * a[p[i]];
			if (sum >= t) break;
		}
		ll res = abs(sum + sum - s);
		if (chmin(ans, res)) ansv = p;
	} while (next_permutation(all(p))) ;
	
	return ansv;
}