s=list(eval(input()))

s_o = s[::2]

s_e = s[1::2]



od = ["R","U","D"]

ev = ["L","U","D"]



for i in range(len(s_o)):

    if (s_o[i] not in od):

        print("No")

        exit()



for i in range(len(s_e)):

    if (s_e[i] not in ev):

        print("No")

        exit()

print("Yes")
s = eval(input())

R = ["R","U","D"]

L = ["L","U","D"]

for i in range(len(s)):

    if i%2 == 0:

        if (s[i] in R):

            flag = True

        else:

            flag = False

            break

    if i%2 == 1:

        if (s[i] in L):

            flag = True

        else:

            flag = False

            break

if flag:

    print("Yes")

else:

    print("No")
s = list(eval(input()))
s_o = s[::2]
s_e = s[1::2]
od = ["R", "U", "D"]
ev = ["L", "U", "D"]
for i in range(len(s_o)):
    if s_o[i] not in od:
        print("No")
        exit()
for i in range(len(s_e)):
    if s_e[i] not in ev:
        print("No")
        exit()
print("Yes")

s = eval(input())
R = ["R", "U", "D"]
L = ["L", "U", "D"]
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] in R:
            flag = True
        else:
            flag = False
            break
    if i % 2 == 1:
        if s[i] in L:
            flag = True
        else:
            flag = False
            break
if flag:
    print("Yes")
else:
    print("No")

-s = list(eval(input())) -s_o = s[::2] -s_e = s[1::2] -od = ["R", "U", "D"] -ev = ["L", "U", "D"] -for i in range(len(s_o)): -    if s_o[i] not in od: -        print("No") -        exit() -for i in range(len(s_e)): -    if s_e[i] not in ev: -        print("No") -        exit() -print("Yes") +s = eval(input()) +R = ["R", "U", "D"] +L = ["L", "U", "D"] +for i in range(len(s)): +    if i % 2 == 0: +        if s[i] in R: +            flag = True +        else: +            flag = False +            break +    if i % 2 == 1: +        if s[i] in L: +            flag = True +        else: +            flag = False +            break +if flag: +    print("Yes") +else: +    print("No")