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

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

solve :: M.Map B.ByteString Int -> Int -> [B.ByteString]
solve m prevV 
    | M.null m = []
    | otherwise =
        let
            ((k, v), m') = M.deleteFindMax m
        in
            if prevV == v
                then [k] ++ solve m' v
                else [k]

main = do
    n <- readLn :: IO Int
    strs <- V.replicateM n B.getLine
    let m = V.foldl' (\m s -> upd m s) M.empty strs
    let ((_, maxV), _) = M.deleteFindMax m
    let res = solve m maxV 
    forM_ (sort res) $ \r -> putStrLn $ B.unpack r