module Main where

import Data.List
import qualified Data.Map.Strict as Map
import Control.Monad
import Data.Ord

main = do
    printRes =<< solve <$> (readStrings =<< readInt)

readStrings :: Int -> IO [String]
readStrings n = replicateM n getLine

readInt :: IO Int
readInt = read <$> getLine

solve :: [String] -> [String]
solve strs = ret
    where
        sorted = sortOn (Down . snd) $ Map.toList $ Map.fromListWith (+) $ map (\s -> (s, 1)) strs
        maxVal = snd $ head sorted
        ret = map fst $ takeWhile ((== maxVal) . snd) sorted

printRes :: [String] -> IO ()
printRes [] = return ()
printRes (x:xs) = do
    putStrLn x
    printRes xs
