let () = Scanf.scanf "%d %d %d %d\n" @@ fun x y z k ->
  let as_ = Array.init x @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let bs = Array.init y @@ fun _ -> Scanf.scanf "%d " @@ fun b -> b in
  let cs = Array.init z @@ fun _ -> Scanf.scanf "%d " @@ fun c -> c in
  Array.sort (fun a a' -> compare a' a) as_;
  Array.sort (fun b b' -> compare b' b) bs;
  Array.sort (fun c c' -> compare c' c) cs;
  let abcs =
    Array.of_list @@
    List.concat @@ Array.to_list @@ Array.init (min x k) @@ fun i ->
      List.concat @@ Array.to_list @@ Array.init (min y (k / (i + 1))) @@ fun j ->
        Array.to_list @@ Array.init (min z (k / (i + 1) / (j + 1))) @@ fun k ->
          as_.(i) + bs.(j) + cs.(k) in
  Array.sort (fun abc abc' -> compare abc' abc) abcs;
  for i = 0 to k - 1 do
    Printf.printf "%d\n" abcs.(i)
  done
