import Data.List parseInput :: String -> [Int] parseInput = map read . lines process :: [Int] -> [Char] process = map fst . sortBy (\(_, x) (_, y) -> compare y x) . zip ['A'..] output :: [Char] -> IO () output = mapM_ (putStrLn . (:[])) main :: IO () main = getContents >>= output . process . parseInput