import Data.List
import Data.Function (on)
import Control.Applicative

main = do
  _ <- getLine
  xxs <- reverse . sortBy (compare `on` length) . group . sort . lines <$> getContents :: IO [[String]]
  let max1 = length . head $ xxs
  let result = sort [head xs | xs <- xxs, length xs == max1]
  show' result
  where
    show' = putStr . unlines
