
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 abs = Array.init (min k x * min k y) @@ fun i -> as_.(i mod min k x) + bs.(i / min k x) in
  Array.sort (fun ab ab' -> compare ab' ab) abs;
  let abcs = Array.init (min k (min k x * min k y) * min k z) @@ fun i -> abs.(i / min k z) + cs.(i mod min k z) in
  Array.sort (fun abc abc' -> compare abc' abc) abcs;
  for i = 0 to k - 1 do
    Printf.printf "%d\n" abcs.(i)
  done

