open Batteries

let xyzk = List.map int_of_string (String.split_on_char ' ' (read_line()))
let (x, y, z, k) = match xyzk with
   [x; y; z; k] -> (x, y, z, k)
 | _ -> (1, 1, 1, 1)
let a = List.map int_of_string (String.split_on_char ' ' (read_line()))
let b = List.map int_of_string (String.split_on_char ' ' (read_line()))
let c = List.map int_of_string (String.split_on_char ' ' (read_line()))
         
let sumlist lst1 lst2 lst3 =
  let rec hojo p q r =    
    if p < x then
      if q < y then
        if r < z then
          let ap = List.nth lst1 p in
          let bq = List.nth lst2 q in
          let cr = List.nth lst3 r in
          let sumall = ap + bq + cr in
          sumall :: hojo p q (r+1)
        else hojo p (q+1) 0
      else hojo (p+1) 0 0
    else [] in
  hojo 0 0 0

let rec ins_sort lst = match lst with
    [] -> []
  | first :: rest ->
     let rec insert n lst = match lst with
         [] -> [n]
       | first :: rest -> if n >= first then n :: insert first rest
                          else first :: insert n rest in
     insert first (ins_sort rest)

let last = ins_sort (sumlist a b c)
let rec answer i = if i < k then (print_int (List.nth last i);
                                  print_string "\n";
                                  answer (i+1))
                   else ()
let () = answer 0