y, m, d = map(int, input().split()) if 1989 == y and 1 <= m <= 12 and 8 <= d <= 31: print("Yes") elif 1990 <= y <= 2018and 1 <= m <= 12 and 1 <= d <= 31: print("Yes") elif 2019 == y and 1 <= m <= 4 and 1 <= d <= 31: print("Yes") else: print("No")