import Data.List

main = do
  n <- readLn :: IO Int
  ss <- lines <$> getContents :: IO [String]
  putStr $ unlines $ let total = count ss
                         k = fst (head total)
                         top x = fst x == k
                     in map snd $ takeWhile top total

count ss = sort $ uniq [] $ sort ss
    where uniq y [] = y
          uniq [] (s: ss) = uniq [(-1, s)] ss
          uniq y @((n, t): z) (s: ss) = uniq (if s == t then (n-1, t): z else (-1, s): y) ss
