import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
    n <- getInt
    ss <- replicateM n getLine
    putStrLn . unlines $ solve ss

solve ss = [head s | s <- gs , length s == l]
    where gs = group $ sort ss
          l = maximum $ map length gs