print("Yes" if '19890108'<=input().replace(' ','')<='20190430' else 'No')