#include "partition.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> solve(vector<int> a) {
  int n = a.size();
  ll full = 0;
  vector<int> perm(n);
  for (int i = 0; i < n; i++) {
    perm[i] = i;
    full += a[i];
  }
  vector<int> best = perm;
  int ans = INT_MAX;
  while (next_permutation(perm.begin(), perm.end())) {
    ll s = 0;
    for (int j = 0; j < n; j++) {
      s += a[perm[j]];
      if (2 * s >= full) {
        int now = abs(j + 1 - (n - j - 1));
        if (now < ans) {
          best = perm;
          ans = now;
        }
        break;
      }
    }
  }
  return best;
}
