#include<iostream>
#include<vector>
#include "partition.cpp"
using namespace std;
extern vector<int> solve(vector<int> A);
int main () {
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    int t;
    cin >> t ;
    for (int test=1; test<=t; test++) {
        int n;
        cin >> n ;
        vector <int> a(n);
        int64_t sum = 0;
        for (int i=0; i<n; i++) {
            cin >> a[i] ;
            sum += a[i];
        }

        int64_t s = 0;
        vector <int> v = solve(a);
        for (int u : v)
            if (s * 2 < sum)
                s += a[u];
            else
                break;
        for (auto ind : v)
            cout << ind << " ";
        cout << "- " << (s * 2 - sum) << endl ;
    }
    cout << endl ;
    return 0;
}
