y, m, d = map(int, input().split()) m = '{:0=2}'.format(m) d = '{:0=2}'.format(d) x = int(str(y) + str(m) + str(d)) print(['No', 'Yes'][19890108 <= x <= 20190430])