#include <bits/stdc++.h>

using namespace std;

#define int ll

#define fi first
#define se second

#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()

using ll = long long;
using pii = pair<int, int>;

const int NMAX = 2e6+5;

int n, S;
vector<signed> a, idx, v, best;
bool ap[NMAX];
int ans;

void backtrack(int cnt = 0, int s = 0) {
   if (ans <= 1) return;

   if (2ll * s >= S) {
      if (abs(n - cnt - cnt) < ans) {
         ans = abs(n - cnt - cnt);
         best = v;
         for (int i = 0; i < n; i++) {
            if (!ap[i]) {
               best.push_back(i);
            }
         }
      }
      return;
   }

   for (int i = 0; i < n; i++) {
      if (!ap[i]) {
         ap[i] = true;
         v.push_back(i);
         backtrack(cnt + 1, s + a[i]);
         v.pop_back();
         ap[i] = false;
      }
   }
}

vector<signed> solve(vector<signed> A) {
   n = sz(A);
   a = A;
   fill(ap, ap + n, false);
   v.clear();
   best.clear();

   ans = n;
   idx.clear();
   S = 0;
   for (int i = 0; i < n; i++) {
      S += a[i];
      idx.push_back(i);
   }

   sort(all(idx), [&](int i, int j) {
      return a[i] < a[j];
   });

   backtrack();

#ifdef LOCAL
   cout << "ans " << ans << endl;
#endif
   
   return best;
}

#undef int

#ifdef LOCAL
namespace grader {
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);
        for (int i=0; i<n; i++) {
            cin >> a[i] ;
        }

        auto ans = solve(a);
        for (auto ind : ans) {
            cout << a[ind] << " ";
        }
        cout << endl;

        sort(all(ans));
        assert(sz(ans) == n);

        for (int i = 0; i < n; i++) {
           assert(i == ans[i]);
        }
    }
    cout << endl ;
    return 0;
}
};
signed main() {
   freopen("input.txt", "r", stdin);
   grader::main();
   return 0;
}
#endif
