#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int T, s = 0; cin >> T; assert(1 <= T && T <= 200000); auto solve = [&](){ int N, M; cin >> N >> M; s += N + M; assert(0 <= N && 0 <= M); vector A(N), B(M), ab, a, b; for(auto &v : A){ cin >> v; assert(1 <= v && v <= 1000000000); } for(auto &v : B){ cin >> v; assert(1 <= v && v <= 1000000000); } sort(A.begin(), A.end()); sort(B.begin(), B.end()); set_intersection(A.begin(), A.end(), B.begin(), B.end(), inserter(ab, ab.end())); set_difference(A.begin(), A.end(), ab.begin(), ab.end(), inserter(a, a.end())); set_difference(B.begin(), B.end(), ab.begin(), ab.end(), inserter(b, b.end())); if(!a.empty() && !b.empty() && ab.empty()){ cout << "No" << '\n'; return; } cout << "Yes" << '\n'; for(auto &v : a)cout << "Red " << v << '\n'; if(!ab.empty()){ cout << "Red " << ab[0] << '\n'; cout << "Blue " << ab[0] << '\n'; } for(auto &v : b)cout << "Blue " << v << '\n'; for(int i = 1; i < ab.size(); i++){ if(i & 1){ cout << "Blue " << ab[i] << '\n'; cout << "Red " << ab[i] << '\n'; }else{ cout << "Red " << ab[i] << '\n'; cout << "Blue " << ab[i] << '\n'; } } }; while(T--) solve(); assert(s <= 200000); }