#include "bits/stdc++.h" using namespace std; using LL = long long; using ll = long long; #define all(x) begin(x),end(x) mt19937 rng{56719}; void solve() { int n; cin >> n; array ns; cin >> ns[0] >> ns[1] >> ns[2]; vector x(n); LL s = 0; for (int i = 0; i < n; ++i) { cin >> x[i]; s += x[i]; } shuffle(all(x), rng); array sums{}; array, 3> sets{}; auto good = [&]() -> bool { return 2*sums[0] < s && 2*sums[1] < s && 2*sums[2] < s; }; auto insert = [&](int i, LL v) { sets[i].insert(v); sums[i] += v; }; auto erase = [&](int i, LL v) { auto it = sets[i].find(v); assert(it != end(sets[i])); sets[i].erase(it); sums[i] -= v; }; for (int i = 0; i < ns[0]; ++i) insert(0, x[i]); for (int i = 0; i < ns[1]; ++i) insert(1, x[ns[0] + i]); for (int i = 0; i < ns[2]; ++i) insert(2, x[ns[0] + ns[1] + i]); for (int it = 0; !good() && it < 6 * n; ++it) { int imin = 0, imax = 0; for (int j = 0; j < 3; ++j) { if (sums[j] < sums[imin]) imin = j; if (sums[j] > sums[imax]) imax = j; } assert(imax != imin); LL small = *begin(sets[imin]); LL big = *prev(end(sets[imax])); erase(imin, small); erase(imax, big); insert(imin, big); insert(imax, small); } if (good()) { cout << "YES\n"; for (LL i : sets[0]) cout << i << " "; cout << "\n"; for (LL i : sets[1]) cout << i << " "; cout << "\n"; for (LL i : sets[2]) cout << i << " "; cout << "\n"; } else { cout << "NO\n"; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { solve(); } }