x = list(map(int,input().split())) y = x[0] m = x[1] d = x[2] ans = y * 10000 + m * 100 + d if 19890108 <= ans <= 20190430: print("Yes") else: print("No")