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

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

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

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

asort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)

print((asort[0] + bsort[0] + csort[0]))

already = [[0,0,0]]

x,y,z = 0,0,0

place_sum = []

check = []

for k in range(K - 1):

    if [x + 1,y,z] not in already and x + 1 < X:

        already.append([x + 1,y,z])

        place_sum.append([x + 1,y,z])

        check.append(asort[x + 1] + bsort[y] + csort[z])

    if [x,y + 1,z] not in already and y + 1 < Y:

        already.append([x,y + 1,z])

        place_sum.append([x,y + 1,z])

        check.append(asort[x] + bsort[y + 1] + csort[z])

    if [x,y,z + 1] not in already and z + 1 < Z:

        already.append([x,y,z + 1])

        place_sum.append([x,y,z + 1])

        check.append(asort[x] + bsort[y] + csort[z + 1])

    print((max(check)))

    x,y,z = place_sum[check.index(max(check))][0],place_sum[check.index(max(check))][1],place_sum[check.index(max(check))][2]

    place_sum.pop(check.index(max(check)))

    check.remove(max(check))
import heapq

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

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

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

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

asort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)

already = [[0,0,0]]

print((asort[0] + bsort[0] + csort[0]))

x,y,z = 0,0,0

check = []

for k in range(K - 1):

    if [x + 1,y,z] not in already and x + 1 < X:

        already.append([x + 1,y,z])

        heapq.heappush(check,(-(asort[x + 1] + bsort[y] + csort[z]),x + 1,y,z))

    if [x,y + 1,z] not in already and y + 1 < Y:

        already.append([x,y + 1,z])

        heapq.heappush(check,(-(asort[x] + bsort[y + 1] + csort[z]),x,y + 1,z))

    if [x,y,z + 1] not in already and z + 1 < Z:

        already.append([x,y,z + 1])

        heapq.heappush(check,(-(asort[x] + bsort[y] + csort[z + 1]),x,y,z + 1))

    maxsum = heapq.heappop(check)

    print((-maxsum[0]))

    x,y,z = maxsum[1],maxsum[2],maxsum[3]
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
asort, bsort, csort = (
    sorted(A, reverse=True),
    sorted(B, reverse=True),
    sorted(C, reverse=True),
)
print((asort[0] + bsort[0] + csort[0]))
already = [[0, 0, 0]]
x, y, z = 0, 0, 0
place_sum = []
check = []
for k in range(K - 1):
    if [x + 1, y, z] not in already and x + 1 < X:
        already.append([x + 1, y, z])
        place_sum.append([x + 1, y, z])
        check.append(asort[x + 1] + bsort[y] + csort[z])
    if [x, y + 1, z] not in already and y + 1 < Y:
        already.append([x, y + 1, z])
        place_sum.append([x, y + 1, z])
        check.append(asort[x] + bsort[y + 1] + csort[z])
    if [x, y, z + 1] not in already and z + 1 < Z:
        already.append([x, y, z + 1])
        place_sum.append([x, y, z + 1])
        check.append(asort[x] + bsort[y] + csort[z + 1])
    print((max(check)))
    x, y, z = (
        place_sum[check.index(max(check))][0],
        place_sum[check.index(max(check))][1],
        place_sum[check.index(max(check))][2],
    )
    place_sum.pop(check.index(max(check)))
    check.remove(max(check))

import heapq

X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
asort, bsort, csort = (
    sorted(A, reverse=True),
    sorted(B, reverse=True),
    sorted(C, reverse=True),
)
already = [[0, 0, 0]]
print((asort[0] + bsort[0] + csort[0]))
x, y, z = 0, 0, 0
check = []
for k in range(K - 1):
    if [x + 1, y, z] not in already and x + 1 < X:
        already.append([x + 1, y, z])
        heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z))
    if [x, y + 1, z] not in already and y + 1 < Y:
        already.append([x, y + 1, z])
        heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z))
    if [x, y, z + 1] not in already and z + 1 < Z:
        already.append([x, y, z + 1])
        heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1))
    maxsum = heapq.heappop(check)
    print((-maxsum[0]))
    x, y, z = maxsum[1], maxsum[2], maxsum[3]

+import heapq + +already = [[0, 0, 0]] -already = [[0, 0, 0]] -place_sum = [] -        place_sum.append([x + 1, y, z]) -        check.append(asort[x + 1] + bsort[y] + csort[z]) +        heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z)) -        place_sum.append([x, y + 1, z]) -        check.append(asort[x] + bsort[y + 1] + csort[z]) +        heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z)) -        place_sum.append([x, y, z + 1]) -        check.append(asort[x] + bsort[y] + csort[z + 1]) -    print((max(check))) -    x, y, z = ( -        place_sum[check.index(max(check))][0], -        place_sum[check.index(max(check))][1], -        place_sum[check.index(max(check))][2], -    ) -    place_sum.pop(check.index(max(check))) -    check.remove(max(check)) +        heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1)) +    maxsum = heapq.heappop(check) +    print((-maxsum[0])) +    x, y, z = maxsum[1], maxsum[2], maxsum[3]