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