import Data.List (sortBy) import Data.Ord (comparing) sortBrothers :: Ord a => [a] -> [String] sortBrothers = fmap fst . sortBy (flip $ comparing snd) . zip ["A", "B", "C"] readInt :: String -> Int readInt = read main :: IO () main = interact $ unlines . sortBrothers . fmap readInt . take 3 . lines