#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;

vector <int> V;
void r(ll n, ll sum1, ll sum2) {
    if (n != V.sz) {
        if (sum1 <= sum2) {
            r(n + 1, sum1 + V[n], sum2);
        }
        else {
            r(n + 1, sum1, sum2 + V[n]);
        }
    }
}


std::vector<int> solve(std::vector<int> A) {
    V = A;
    sort(V.rbegin(), V.rend());

    r(0, 0, 0);

    return V;
}