#include <bits/stdc++.h>

using namespace std;

vector < int > solve ( vector < int > a )
{
    int n = a.size (), i, ch;
    long long s, sum, mina;
    vector < int > perm;
    vector < int > ans ( n );
    for ( i = 0 ; i < n ; i++ )
        perm.push_back ( i );
    ans[0] = 1e9 + 6;
    s = 0;
    for ( i = 0 ; i < n ; i++ )
        s = s + a[i];
    mina = n;
    ch = n + 1;
    do
    {
        int x = 0;
        while ( x <= ch && ans[x] == perm[x] )
            x++;
        if ( x <= ch )
        {
            i = 0;
            sum = 0;
            while ( i < n && !( sum >= ( s + 1 ) / 2 ) )
                sum = sum + a[perm[i++]];
            if ( abs ( n - 2 * i ) < mina )
            {
                ch = i - 1;
                mina = abs ( n - 2 * i );
                for ( i = 0 ; i < n ; i++ )
                    ans[i] = perm[i];
            }
        }
    }
    while ( mina > s % 2 && next_permutation ( perm.begin (), perm.end () ) );
    return ans;
}
