import qualified Data.Map as M
import Control.Monad
import Data.List

main :: IO ()
main = do
  n <- readLn
  ss <- replicateM n getLine
  putStrLn $ unlines $ solve ss

solve :: [String] -> [String]
solve = sort . freq . count
  where
    count = foldr (\s mp -> M.insertWith (+) s 1 mp) M.empty
    freq mp = let cm = M.foldr max 0 mp in M.keys (M.filter (== cm) mp)
    
    
