a[9];b[];main(i,s){while(~scanf("%s%s%s",a,b,s))puts(strstr(b,a)&&strstr(s,b)?"YES":"NO");}