while(1>0)for(p<-readLine split" "permutations;s=p.mkString)if(s matches".(.)\\1(.)\\2.")println(s)