def solve(): n, m = map(int, input().split()) A = set(map(int, input().split())) B = set(map(int, input().split())) if not A: print("Yes") for b in B: print("Blue", b) return if not B: print("Yes") for a in A: print("Red", a) return same = A & B if len(same) == 0: print("No") return print("Yes") A -= same B -= same p = same.pop() for a in A: print("Red", a) print("Red", p) print("Blue", p) for b in B: print("Blue", b) r = "Red" b = "Blue" for p in same: print(b, p) print(r, p) r, b = b, r for _ in range(int(input())): solve()