import Control.Monad
import Data.List

main = do
    n <- readLn :: IO Int
    sn <- replicateM n getLine
    mapM_ putStrLn $ map head $ head $ reverse $ groupBy(\x y->length x==length y) $ sortOn (length) $ group $ sort sn
