char a[12];i;main(b){gets(a);for(;(b=getchar()-10)&&i-11;a[i]=0)for(i=-1;++i<11&&a[i]-b-10;);i=!printf(i-11?"YES":"NO");}