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

vector<int> solve(vector<int> a){
    int s = 0; for(int i = 0; i < a.size(); i++) s += a[i];
    int d[a.size()+1][s/2+2];
    for(int i = 0; i <= a.size(); i++) for(int j = 0; j < s/2+2; j++) d[i][j] = 0;
    d[0][0] = 1;
    for(int i = 1; i <= a.size(); i++){
        for(int j = 0; j < s/2+2; j++){
            if(d[i-1][j]) {d[i][j] = 1; continue;}
            if(j >= a[i-1] && d[i-1][j-a[i-1]]) d[i][j] = 2;
        }
    }
    vector<int> b, c;
    for(int i = s/2; i >= 0; i--){
        if(d[a.size()][i] == 0) continue;
        int p = i;
        for(int j = a.size(); j > 0; j--){
            if(d[j][p] == 2){
                b.push_back(j-1); p -= a[j-1];
            }
            else c.push_back(j-1);
        }
        break;
    }
    for(int i : b) c.push_back(i);
    return c;
}