X, Y, Z, K = list(map(int, input().split()))

a_cakes = list(map(int, input().split()))

b_cakes = list(map(int, input().split()))

c_cakes = list(map(int, input().split()))

a_b_cakes = []

for a in a_cakes:

  for b in b_cakes:

    a_b_cakes.append(a+b)

a_b_cakes.sort(reverse=True)

a_b_c_cakes = []

for a_b in a_b_cakes[:K]:

  for c in c_cakes:

    a_b_c_cakes.append(a_b+c)

a_b_c_cakes.sort(reverse=True)

for ans in a_b_c_cakes[:K]:

  print(ans)

from heapq import heappush, heappop



X,Y,Z,K = list(map(int, input().split()))

a_list = list(map(int, input().split()))

b_list = list(map(int, input().split()))

c_list = list(map(int, input().split()))

a_list.sort(reverse=True)

b_list.sort(reverse=True)

c_list.sort(reverse=True)

hp = []

checked_dict = {}

max_abc = a_list[0] + b_list[0] + c_list[0]

heappush(hp, (-max_abc,0,0,0))

for _ in range(K):

  ans, ai, bi, ci = heappop(hp)

  print((-ans))

  if ai < X-1 and not (ai+1, bi, ci) in checked_dict:

    checked_dict[(ai+1,bi,ci)] = 1

    heappush(hp, (-(a_list[ai+1]+b_list[bi]+c_list[ci]),ai+1,bi,ci))

  if bi < Y-1 and not (ai,bi+1,ci) in checked_dict:

    checked_dict[(ai,bi+1,ci)] = 1

    heappush(hp, (-(a_list[ai]+b_list[bi+1]+c_list[ci]),ai,bi+1,ci))

  if ci < Z-1 and not (ai,bi,ci+1) in checked_dict:

    checked_dict[(ai,bi,ci+1)] = 1

    heappush(hp, (-(a_list[ai]+b_list[bi]+c_list[ci+1]),ai,bi,ci+1))

             



X, Y, Z, K = list(map(int, input().split()))
a_cakes = list(map(int, input().split()))
b_cakes = list(map(int, input().split()))
c_cakes = list(map(int, input().split()))
a_b_cakes = []
for a in a_cakes:
    for b in b_cakes:
        a_b_cakes.append(a + b)
a_b_cakes.sort(reverse=True)
a_b_c_cakes = []
for a_b in a_b_cakes[:K]:
    for c in c_cakes:
        a_b_c_cakes.append(a_b + c)
a_b_c_cakes.sort(reverse=True)
for ans in a_b_c_cakes[:K]:
    print(ans)

from heapq import heappush, heappop

X, Y, Z, K = list(map(int, input().split()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
a_list.sort(reverse=True)
b_list.sort(reverse=True)
c_list.sort(reverse=True)
hp = []
checked_dict = {}
max_abc = a_list[0] + b_list[0] + c_list[0]
heappush(hp, (-max_abc, 0, 0, 0))
for _ in range(K):
    ans, ai, bi, ci = heappop(hp)
    print((-ans))
    if ai < X - 1 and not (ai + 1, bi, ci) in checked_dict:
        checked_dict[(ai + 1, bi, ci)] = 1
        heappush(hp, (-(a_list[ai + 1] + b_list[bi] + c_list[ci]), ai + 1, bi, ci))
    if bi < Y - 1 and not (ai, bi + 1, ci) in checked_dict:
        checked_dict[(ai, bi + 1, ci)] = 1
        heappush(hp, (-(a_list[ai] + b_list[bi + 1] + c_list[ci]), ai, bi + 1, ci))
    if ci < Z - 1 and not (ai, bi, ci + 1) in checked_dict:
        checked_dict[(ai, bi, ci + 1)] = 1
        heappush(hp, (-(a_list[ai] + b_list[bi] + c_list[ci + 1]), ai, bi, ci + 1))

+from heapq import heappush, heappop + -a_cakes = list(map(int, input().split())) -b_cakes = list(map(int, input().split())) -c_cakes = list(map(int, input().split())) -a_b_cakes = [] -for a in a_cakes: -    for b in b_cakes: -        a_b_cakes.append(a + b) -a_b_cakes.sort(reverse=True) -a_b_c_cakes = [] -for a_b in a_b_cakes[:K]: -    for c in c_cakes: -        a_b_c_cakes.append(a_b + c) -a_b_c_cakes.sort(reverse=True) -for ans in a_b_c_cakes[:K]: -    print(ans) +a_list = list(map(int, input().split())) +b_list = list(map(int, input().split())) +c_list = list(map(int, input().split())) +a_list.sort(reverse=True) +b_list.sort(reverse=True) +c_list.sort(reverse=True) +hp = [] +checked_dict = {} +max_abc = a_list[0] + b_list[0] + c_list[0] +heappush(hp, (-max_abc, 0, 0, 0)) +for _ in range(K): +    ans, ai, bi, ci = heappop(hp) +    print((-ans)) +    if ai < X - 1 and not (ai + 1, bi, ci) in checked_dict: +        checked_dict[(ai + 1, bi, ci)] = 1 +        heappush(hp, (-(a_list[ai + 1] + b_list[bi] + c_list[ci]), ai + 1, bi, ci)) +    if bi < Y - 1 and not (ai, bi + 1, ci) in checked_dict: +        checked_dict[(ai, bi + 1, ci)] = 1 +        heappush(hp, (-(a_list[ai] + b_list[bi + 1] + c_list[ci]), ai, bi + 1, ci)) +    if ci < Z - 1 and not (ai, bi, ci + 1) in checked_dict: +        checked_dict[(ai, bi, ci + 1)] = 1 +        heappush(hp, (-(a_list[ai] + b_list[bi] + c_list[ci + 1]), ai, bi, ci + 1))