{-# OPTIONS -Wno-x-partial #-} module Main where import Control.Arrow import Control.Monad (join) import Data.Bifunctor (bimap) import Data.List (group, sort) main :: IO () main = runKleisli (const () ^<< join (***) (Kleisli print)) . join bimap (product . map snd . take 3) . (reverse &&& id) . sort . map (length &&& head) . group . sort . map (read @Int) . words =<< getContents