import List main@m=do{x<-getLine;putStrLn$head$filter(and.zipWith(==)x.cycle)(tail$inits x);m}