y, m, d = map(int, input().split()) s = y * 10000 + m * 100 + d if 19891231 <= s <= 20190430: print("Yes") else: print("No")