Y, M, D = input().split() ymd = Y + M.zfill(2) + D.zfill(2) if 19890108 <= int(ymd) <= 20190430: print('Yes') else: print('No')