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