y,m,d = input().split() date = int(y + m.zfill(2) + d.zfill(2)) if 19890108 <= date & date <=20190430: print("Yes") else: print("No")