#include using namespace std; #define tsolve int t; cin >> t; while (t--) solve #define all(x) ::begin(x), ::end(x) #define sz(x) (ll)::size(x) using ll = long long; using ld = long double; void solve() { int n, na, nb, nc; cin >> n >> na >> nb >> nc; vector a(n); for (ll& e : a) cin >> e; ll tot = accumulate(all(a), 0LL); sort(all(a), greater<>()); int b[3] = {na, nb, nc}; sort(all(b)); vector> ans(3); vector sm(3); vector rest; for (ll x : a) { if (ssize(ans[0]) < b[0] && sm[0] * 4 < tot) ans[0].push_back(x), sm[0] += x; else if (ssize(ans[1]) < b[1] && sm[1] * 4 < tot) ans[1].push_back(x), sm[1] += x; else if (ssize(ans[2]) < b[2] && sm[2] * 4 < tot) ans[2].push_back(x), sm[2] += x; else rest.push_back(x); } for (ll x : rest) { if (ssize(ans[0]) < b[0]) ans[0].push_back(x), sm[0] += x; else if (ssize(ans[1]) < b[1]) ans[1].push_back(x), sm[1] += x; else ans[2].push_back(x), sm[2] += x; } for (int i=0; i<3; i++) { if (sm[i] * 2 >= tot || ssize(ans[i]) != b[i]) { cout << "NO\n"; return; } } cout << "YES\n"; for (auto s : {na, nb, nc}) { for (auto& e : ans) if (ssize(e) == s) { for (ll x : e) cout << x << ' '; cout << '\n'; e.clear(); break; } } } int main() { cin.tie(0)->sync_with_stdio(false); cout << setprecision(16); tsolve(); }