y,m,d=map(int,input().split()) if y<1989 or y>2019: print("No") elif y>1989 and y<2019: print("Yes") elif y==1989: if m>1 or d>7: print("Yes") else: print("No") else: if m<5: print("Yes") else: print("No")