for i in range(eval(input())):

	step=input()

	flag=0

	for j in range(len(step)-1):

		if step[j]==step[j+1]:

			print("No")

			break

	else:

		print("Yes")
for i in range(eval(input())):

	step=input().replace("LL","1").replace("UU","1").replace("DD","1").replace("RR","1")

	print("No" if "1" in step else "Yes")
for i in range(eval(input())):
    step = input()
    flag = 0
    for j in range(len(step) - 1):
        if step[j] == step[j + 1]:
            print("No")
            break
    else:
        print("Yes")

for i in range(eval(input())):
    step = (
        input()
        .replace("LL", "1")
        .replace("UU", "1")
        .replace("DD", "1")
        .replace("RR", "1")
    )
    print("No" if "1" in step else "Yes")

-    step = input() -    flag = 0 -    for j in range(len(step) - 1): -        if step[j] == step[j + 1]: -            print("No") -            break -    else: -        print("Yes") +    step = ( +        input() +        .replace("LL", "1") +        .replace("UU", "1") +        .replace("DD", "1") +        .replace("RR", "1") +    ) +    print("No" if "1" in step else "Yes")