import Data.Text as T
import Data.Text.Encoding as E
import Data.ByteString (ByteString)
 
dummyInput :: String
dummyInput = "1819\n2003\n876\n2840"
 
convertList :: Text -> [Int]
convertList x =
  let charcter = T.pack "\n"
  in Prelude.map convertInt (Prelude.map T.unpack (T.splitOn charcter x))
 
convertInt :: String -> Int
convertInt x = read x :: Int
 
sortHeight :: (Ord a) => [a] -> [a]
sortHeight [] = []
sortHeight [x] = [x]
sortHeight (x:xs) =
  let largeList = [a | a <- xs, a > x];
      smallList = [a | a <- xs, a <= x]
  in sortHeight smallList ++ [x] ++ largeList
 
showTopThree :: (Ord a) => [a] -> [a]
showTopThree [] = []
showTopThree x = (Prelude.take 3 x)
 
main :: IO ()
main = do
  inputData <- getContents
  print $ showTopThree (sortHeight (convertList (T.pack inputData)))
