import Data.List

solve :: [[Int]] -> [Int]
solve ([_,_,_,k]:l) = take k $ sortBy (flip compare) $ map sum $ sequence l

main :: IO ()
main = interact $ foldl1 (++) . map ((++"\n") . show) . solve . map (map (read::String->Int) . words) . lines
