Y, M, D = map(int, input().split()) if 19890108 <= int(f"{Y:04}{M:02}{D:02}") <= 20190430: print("Yes") else: print("No")