import qualified Data.ByteString.Char8 as B
import qualified Data.Map.Strict       as M

main :: IO ()
main = do
  n <- readLn
  ss <- B.lines <$> B.getContents
  B.putStr . B.unlines $ solve n ss

solve :: Int -> [B.ByteString] -> [B.ByteString]
solve _ ss = map fst $ filter (\(_, v) -> v == maxV) kvs where
  m = M.fromListWith (+) [(s, 1) | s <- ss] :: M.Map B.ByteString Int
  kvs = M.toList m
  maxV = maximum $ map snd kvs
