import Data.List (foldl')
import qualified Data.Map.Strict as Map
import System.IO (isEOF)

main = do
    input >>= return . solve >>= output

input :: IO [Int]
input = do
    quit <- isEOF
    if quit then return [] else do
        n <- readLn
        fmap (n:) input

output :: [Int] -> IO ()
output = mapM_ print

solve :: [Int] -> [Int]
solve ns = modes
    where
    modes = freqMax `seq` [n|(n,freq) <- Map.toAscList freqs, freq == freqMax]
    freqMax = maximum $ Map.elems freqs
    freqs = foldl' countFreq Map.empty ns
    countFreq freqs n = Map.insertWith (+) n 1 freqs