from sys import stdin def main(): Y, M, D = input().split() d = int(Y + M.zfill(2) + D.zfill(2)) if 19890108 <= d <= 20190430: print('Yes') else: print('No') input = lambda: stdin.readline() main()