import Data.List  -- sortBy, group
import Data.Ord   -- comparing

modes :: [Int] -> [Int]
modes = map fst . takeModes . sortBy (flip $ comparing snd) . freqList
  where takeModes (x:xs) = takeWhile ((>= snd x) . snd) (x:xs)

freqList = map valFrq . group . sort  -- list of value-freq pairs
  where valFrq ls = (head ls, length ls)

main = do
  s <- getContents
  putStr . unlines . map show . modes . map read . lines $ s