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