Y, M, D = map(int, input().split()) def t(y, m, d): return y * 100000000 + m * 100 + d if t(1989, 1, 8) <= t(Y, M, D) <= t(2019, 4, 30): print("Yes") else: print("No")