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