Y, M, D = map(int, input().split()) if Y >= 1990 and 2018 >= Y: print('Yes') elif Y == 1989 and M > 1: print('Yes') elif Y == 1989 and M == 1 and D >= 8: print('Yes') elif Y == 2019 and M < 5: print('Yes') else: print('No')