Y,M,D=map(int,input().split())
x=D+M*30+Y*365
if 726023<=x<=737085:
    print("Yes")
else:
    print("No")