a,b,c,d =input().split("-")
num = ''.join([a,b,c])
sum = 0
j=1
for i in num:
sum += int(i)*j
j += 1
if sum % 11 == 10:
s = "X"
else:
s = str(sum % 11)
if s == d:
print("Right")
else:
print("-".join([a,b,c,s]))
a,b,c,d =input().split("-")
num = ''.join([a,b,c])
sum = 0
j=1
for i in num:
sum += int(i)*j
j += 1
if sum % 11 == 10:
s = "X"
else:
s = str(sum % 11)
if s == d:
print("Right")
else:
print("-".join([a,b,c,s]))