Y, M, D = map(int, input().split()) YMD = 10**4 * Y + 10**2 * M + D print( "Yes" if 19890108 <= YMD <= 20190430 else "No")