#include #define int long long using namespace std; string to_string(string s) { return s; } template string to_string(T v) { string res = "["; for (const auto &x : v) { res += to_string(x) + ", "; } res += "]"; return res; } void dbg_out() { cout << endl; } template void dbg_out(Head H, Tail... T) { cout << ' ' << to_string(H); dbg_out(T...); } #ifdef DEBUG #define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__) #else #define dbg(...) #endif using ll = long long; using vi = vector; #define rep(i, a, b) for (int i = (a); i < (b); ++i) #define all(v) (v).begin(), (v).end() #define sz(v) ((int)(v).size()) const int MAX_VALUES = 3e5; vector Val; priority_queue Mini; int nbValues; int Size[3]; bool SortSz(int a, int b) { return Size[a] < Size[b]; } vector Fill(int size, int bound) { int sum = 0; sort(all(Val)); vector left; for (int i = 0; i < size; i ++) { sum += Val[i]; Mini.push(Val[i]); } for (int i = sz(Val) - 1; i >= size; i --) { if (Mini.empty()) break; if (Val[i] - Mini.top() + sum <= bound) { sum += Val[i] - Mini.top(); Mini.pop(); Val[i] *= -1; } } int cnt = 0; while (!Mini.empty()) { Val[cnt ++] *= -1; Mini.pop(); } vector ans; for (int i = 0; i < sz(Val); i ++) { if (Val[i] >= 0) left.push_back(Val[i]); else ans.push_back(- Val[i]); } Val = left; return sum <= bound ? ans : (vi){}; } void Read() { cin >> nbValues; for (int i = 0; i < 3; i ++) cin >> Size[i]; Val.clear(); int tot = 0; for (int i = 0; i < nbValues; i ++) { int a; cin >> a; Val.push_back(a); tot += a; } vector id = {0, 1, 2}; vector ans[3]; sort(all(id), SortSz); for (int i : id) { ans[i] = Fill(Size[i], (tot - 1) / 2); if (!ans[i].size()) { cout << "NO\n"; return; } } cout << "YES\n"; for (int i = 0; i < 3; i ++) { for (int a : ans[i]) cout << a << " "; cout << "\n"; } return; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int nbTests; cin >> nbTests; for (int i = 0; i < nbTests; i ++) Read(); return 0; }