for(i in strsplit(readLines("stdin")," "))cat(if(grepl(i[1],i[2],fixed=T)&&grepl(i[2],i[3],fixed=T))"YES\n"else"NO\n")