line = input() if "1989 1 8" <= line and line <= "2019 4 30": print("Yes") else: print("No")