import datetime s = datetime.datetime.strptime('1989/01/08', '%Y/%m/%d') e = datetime.datetime.strptime('2019/04/30', '%Y/%m/%d') ymd = '/'.join([i for i in input().strip().split(' ')]) ymd = datetime.datetime.strptime(ymd, '%Y/%m/%d') print('Yes' if s <= ymd and ymd <= e else 'No')