import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as B
import Data.List
import qualified Data.Map as M
import Control.Monad
import Data.Tuple
import Data.Ord

make :: M.Map B.ByteString Int -> B.ByteString -> M.Map B.ByteString Int
make m bs =
    case M.lookup bs m of
        Just i -> M.adjust (+1) bs m
        Nothing -> M.insert bs 1 m

solve :: [(Int, B.ByteString)] -> (Int, B.ByteString) -> [B.ByteString]
solve [] _ = []
solve ((a,b):xs) (a', b')
    | a == a' = [b] ++ solve xs (a, b)
    | otherwise = []

main = do
    n <- readLn :: IO Int
    strs <- V.replicateM n B.getLine
    let m = V.foldl' (\m s -> make m s) M.empty strs
    let ms = sortBy (comparing Down) $ map swap $ M.toList m
    let res = solve ms (head ms)
    forM_ (sort res) $ \r -> putStrLn $ B.unpack r