y,m,d=map(int,input().split()) print("NYoe s"[(19892 or(m==1 and d>7)))or(y==2019 and m<5)::2])