import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); PrintWriter pw = new PrintWriter(System.out); for (int z = 0; z < t; z++) { String[] sa = br.readLine().split(" "); // int n = Integer.parseInt(sa[0]); // int m = Integer.parseInt(sa[1]); List a = new ArrayList<>(); List b = new ArrayList<>(); Set seta = new HashSet<>(); Set setb = new HashSet<>(); sa = br.readLine().split(" "); for (int i = 0; i < sa.length; i++) { try { long ai = Long.parseLong(sa[i]); a.add(ai); seta.add(ai); } catch (Exception e) { } } sa = br.readLine().split(" "); for (int i = 0; i < sa.length; i++) { try { long bi = Long.parseLong(sa[i]); b.add(bi); setb.add(bi); } catch (Exception e) { } } int n = a.size(); int m = b.size(); for (long i : a) { if (!setb.contains(i)) { seta.remove(i); } } if (seta.isEmpty()) { if (n == 0 || m == 0) { pw.println("Yes"); if (n == 0) { for (long i : b) { pw.println("Blue " + i); } } else { for (long i : a) { pw.println("Red " + i); } } } else { pw.println("No"); } } else { pw.println("Yes"); for (long i : a) { if (!seta.contains(i)) { pw.println("Red " + i); } } Long[] arr = seta.toArray(new Long[0]); pw.println("Red " + arr[0]); pw.println("Blue " + arr[0]); for (long i : b) { if (!seta.contains(i)) { pw.println("Blue " + i); } } for (int i = 1; i < arr.length; i++) { if (i % 2 == 0) { pw.println("Red " + arr[i]); pw.println("Blue " + arr[i]); } else { pw.println("Blue " + arr[i]); pw.println("Red " + arr[i]); } } } } pw.flush(); br.close(); } }