import heapq



x, y, z, k = map(int, input().split())

ls = [list(map(int, input().split())) for _ in range(3)]

for i in range(3):

    ls[i].sort(reverse=True)

q = [(-sum([ls[i][0] for i in range(3)]), 0, 0, 0)]

res = []

used = [(0, 0, 0)]

while len(res) < k:

    s, i, j, l = heapq.heappop(q)

    res.append(-s)

    if i + 1 < x and (i + 1, j, l) not in used:

        heapq.heappush(q, (-(ls[0][i + 1] + ls[1][j] + ls[2][l]), i + 1, j, l))

        used.append((i + 1, j, l))

    if j + 1 < y and (i, j + 1, l) not in used:

        heapq.heappush(q, (-(ls[0][i] + ls[1][j + 1] + ls[2][l]), i, j + 1, l))

        used.append((i, j + 1, l))

    if l + 1 < z and (i, j, l + 1) not in used:

        heapq.heappush(q, (-(ls[0][i] + ls[1][j] + ls[2][l + 1]), i, j, l + 1))

        used.append((i, j, l + 1))

print(*res, sep='\n')

import collections

import heapq



x, y, z, k = map(int, input().split())

ls = [list(map(int, input().split())) for _ in range(3)]

for i in range(3):

    ls[i].sort(reverse=True)

q = [(-sum([ls[i][0] for i in range(3)]), 0, 0, 0)]

res = []

used = collections.defaultdict(lambda: False)

while len(res) < k:

    s, i, j, l = heapq.heappop(q)

    res.append(-s)

    if i + 1 < x and not used[(i + 1, j, l)]:

        heapq.heappush(q, (-(ls[0][i + 1] + ls[1][j] + ls[2][l]), i + 1, j, l))

        used[(i + 1, j, l)] = True

    if j + 1 < y and not used[(i, j + 1, l)]:

        heapq.heappush(q, (-(ls[0][i] + ls[1][j + 1] + ls[2][l]), i, j + 1, l))

        used[(i, j + 1, l)] = True

    if l + 1 < z and not used[(i, j, l + 1)]:

        heapq.heappush(q, (-(ls[0][i] + ls[1][j] + ls[2][l + 1]), i, j, l + 1))

        used[(i, j, l + 1)] = True

print(*res, sep='\n')

import heapq

x, y, z, k = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(3)]
for i in range(3):
    ls[i].sort(reverse=True)
q = [(-sum([ls[i][0] for i in range(3)]), 0, 0, 0)]
res = []
used = [(0, 0, 0)]
while len(res) < k:
    s, i, j, l = heapq.heappop(q)
    res.append(-s)
    if i + 1 < x and (i + 1, j, l) not in used:
        heapq.heappush(q, (-(ls[0][i + 1] + ls[1][j] + ls[2][l]), i + 1, j, l))
        used.append((i + 1, j, l))
    if j + 1 < y and (i, j + 1, l) not in used:
        heapq.heappush(q, (-(ls[0][i] + ls[1][j + 1] + ls[2][l]), i, j + 1, l))
        used.append((i, j + 1, l))
    if l + 1 < z and (i, j, l + 1) not in used:
        heapq.heappush(q, (-(ls[0][i] + ls[1][j] + ls[2][l + 1]), i, j, l + 1))
        used.append((i, j, l + 1))
print(*res, sep="\n")

import collections
import heapq

x, y, z, k = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(3)]
for i in range(3):
    ls[i].sort(reverse=True)
q = [(-sum([ls[i][0] for i in range(3)]), 0, 0, 0)]
res = []
used = collections.defaultdict(lambda: False)
while len(res) < k:
    s, i, j, l = heapq.heappop(q)
    res.append(-s)
    if i + 1 < x and not used[(i + 1, j, l)]:
        heapq.heappush(q, (-(ls[0][i + 1] + ls[1][j] + ls[2][l]), i + 1, j, l))
        used[(i + 1, j, l)] = True
    if j + 1 < y and not used[(i, j + 1, l)]:
        heapq.heappush(q, (-(ls[0][i] + ls[1][j + 1] + ls[2][l]), i, j + 1, l))
        used[(i, j + 1, l)] = True
    if l + 1 < z and not used[(i, j, l + 1)]:
        heapq.heappush(q, (-(ls[0][i] + ls[1][j] + ls[2][l + 1]), i, j, l + 1))
        used[(i, j, l + 1)] = True
print(*res, sep="\n")

+import collections -used = [(0, 0, 0)] +used = collections.defaultdict(lambda: False) -    if i + 1 < x and (i + 1, j, l) not in used: +    if i + 1 < x and not used[(i + 1, j, l)]: -        used.append((i + 1, j, l)) -    if j + 1 < y and (i, j + 1, l) not in used: +        used[(i + 1, j, l)] = True +    if j + 1 < y and not used[(i, j + 1, l)]: -        used.append((i, j + 1, l)) -    if l + 1 < z and (i, j, l + 1) not in used: +        used[(i, j + 1, l)] = True +    if l + 1 < z and not used[(i, j, l + 1)]: -        used.append((i, j, l + 1)) +        used[(i, j, l + 1)] = True