numbers = input().split(',')numbers = [int(num) for num in numbers]
all_three_digits = Truefor num in numbers:if num == 0:breakif len(str(num)) != 3:all_three_digits = False
if all_three_digits:print("Yes")else:print("No")
numbers = input().split(',')
numbers = [int(num) for num in numbers]
all_three_digits = True
for num in numbers:
if num == 0:
break
if len(str(num)) != 3:
all_three_digits = False
if all_three_digits:
print("Yes")
else:
print("No")