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