Y,M,D=map(int,input().split()) print("Yes" if (1989,1,8)<=(Y,M,D)<=(2019,4,30) else "No")