while(0<1)println(if(readLine matches("(.*) (.*\\1.*) .*\\2.*"))"YES"else"NO")