Hs = 19890108 He = 20190430 Y, M, D = map(int,input().split()) Hn = Y * 10000 + M * 100 + D S = 'Yes' if Hs <= Hn <= He else 'No' print(S)