import Data.List

solve :: [[Int]] -> [(Int,Int)] ->	[Int]
solve _ [] = []
solve l ((a,b):xs)
  | a == m l = b :	solve l xs
  | otherwise = solve l xs
    where m = maximum . map length

main = do
  l <- fmap (group . sort . map (read :: String -> Int) . lines) getContents
  putStr $ unlines $ map show $ solve l $ zip (map length l) (map head l)
