y, m, d = map(int, input().split()) if 1989 < y < 2019: print('Yes') else: if y == 1989: if 1 < m: print('Yes') elif 8 <= d: print('Yes') else: print('No') elif y == 2019: if m < 4: print('Yes') elif m == 4 and d <= 30: print('Yes') else: print('No') else: print('No')