import Data.List

main = do
    getLine
    ss <- lines <$> getContents
    let ss_ = group (sort ss)
        maxslen = maximum $ map length ss_
        maxss = map (\s -> head s) $ filter (\s -> length s == maxslen) ss_
    putStrLn $ unlines maxss