#include using namespace std; int main(){ cin.tie(0),ios::sync_with_stdio(false); string ans,t; cin>>ans>>t; ans+=t.size()==1?'0'+t:t; cin>>t; ans+=t.size()==1?'0'+t:t; cout<<(ans>="19890108"s&&ans<="20190430"s?"Yes"s:"No"s)<<"\n"s; }