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