import random

T = 100
print T
for t in xrange(T):
	print
	N = random.randint(1, 100)
	M = random.randint(1, 100)
	print N, M
	for i in xrange(N):
		print ' '.join([random.choice("RRYBOGP") for j in xrange(M)])

