y,m,d = map(str,input().split()) ymd = int(y + m.zfill(2) + d.zfill(2)) if 19890108 <= ymd and ymd <= 20190430 : print("Yes") else: print("No")