import Data.List main = getLine >> getLine >>= print . snd . last . sort . map ff . group . sort . words where ff x = (length x, ((read :: String -> Int) . head) x)