import Control.Applicative
import Data.List

main = do
  contents <- fmap (read :: String -> Int) . lines <$> getContents
  mapM_ print $ reverse $ solve $ dataCut contents

dataCut :: [Int] -> [[Int]]
dataCut = group . sort

solve :: [[Int]] -> [Int]
solve x = let modeNum = maximum $ fmap length x
              in fst $ split modeNum x ([], [])

equalMode :: Int -> [Int] -> Bool
equalMode modeNum x = modeNum == (length x)

split :: Int -> [[Int]] -> ([Int], [Int]) -> ([Int], [Int])
split _ [] (s, t) = (s, t)
split n (x:xs) (s, t)
  | n == length x = split n xs ((head x):s, t)
  | otherwise = split n xs (s, (head x):t)