# 貪欲法 T = int(input()) for t in range(T): N, M = map(int, input().split()) A = set(map(int, input().split())) B = set(map(int, input().split())) A_solo = [] A_double = [] for a in A: if a in B: A_double.append(a) else: A_solo.append(a) B_solo = [] B_double = [] for b in B: if b in A: B_double.append(b) else: B_solo.append(b) #print(A_solo, A_double) #print(B_solo, B_double) if N == 0: print('Yes') for b in B: print('Blue', b) elif M == 0: print('Yes') for a in A: print('Red', a) else: if len(A_double) == 0: print('No') else: print('Yes') A_double = sorted(list(A_double)) B_double = sorted(list(B_double)) #print(A_solo, A_double, B_solo, B_double) for a in A_solo: print('Red', a) print('Red', A_double[0]) print('Blue', B_double[0]) for b in B_solo: print('Blue', b) for i in range(1, len(A_double)): if i%2 == 1: print('Blue', B_double[i]) print('Red', A_double[i]) else: print('Red', A_double[i]) print('Blue', B_double[i])