a =input().split() y = a[0] m = a[1] d = a[2] def double(n): if len(n)==1: return "0"+n else: return n m = double(m) d = double(d) judge = int(y + m + d) if 19691231<=judge<=20380120: print("Yes") else: print("No")