import heapq

import collections



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()))



A.sort(reverse=True)

B.sort(reverse=True)

C.sort(reverse=True)



heap = []

heapq.heapify(heap)

heapq.heappush(heap,(-(A[0]+B[0]+C[0]),0,0,0))



dictionary = collections.defaultdict(bool)

dictionary[(0,0,0)] = True



i = 0



while i<k:

    M = heapq.heappop(heap)

    print((-M[0]))

    i += 1

    if not dictionary[(M[1]+1,M[2],M[3])] and M[1]+1<x:

        heapq.heappush(heap,(-(A[M[1]+1]+B[M[2]]+C[M[3]]),M[1]+1,M[2],M[3]))

        dictionary[(M[1]+1,M[2],M[3])] = True

    if not dictionary[(M[1],M[2]+1,M[3])] and M[2]+1<y:

        heapq.heappush(heap,(-(A[M[1]]+B[M[2]+1]+C[M[3]]),M[1],M[2]+1,M[3]))

        dictionary[(M[1],M[2]+1,M[3])] = True

    if not dictionary[(M[1],M[2],M[3]+1)] and M[3]+1<z:

        heapq.heappush(heap,(-(A[M[1]]+B[M[2]]+C[M[3]+1]),M[1],M[2],M[3]+1))

        dictionary[(M[1],M[2],M[3]+1)] = True
from heapq import heappop, heappush, heapify



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()))



A.sort(reverse=True)

B.sort(reverse=True)

C.sort(reverse=True)



heap = list()

used = set()

res = list()



heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0))

used.add((0, 0, 0))



for _ in range(K):

    v, i, j, k = heappop(heap)

    res.append(-v)

    if i + 1 < X and (i + 1, j, k) not in used:

        used.add((i + 1, j, k))

        heappush(heap, (-(A[i + 1] + B[j] + C[k]), i + 1, j, k))

    if j + 1 < Y and (i, j + 1, k) not in used:

        used.add((i, j + 1, k))

        heappush(heap, (-(A[i] + B[j + 1] + C[k]), i, j + 1, k))

    if k + 1 < Z and (i, j, k + 1) not in used:

        used.add((i, j, k + 1))

        heappush(heap, (-(A[i] + B[j] + C[k + 1]), i, j, k + 1))

        

print(('\n'.join(map(str, res))))
import heapq
import collections

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()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
heap = []
heapq.heapify(heap)
heapq.heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0))
dictionary = collections.defaultdict(bool)
dictionary[(0, 0, 0)] = True
i = 0
while i < k:
    M = heapq.heappop(heap)
    print((-M[0]))
    i += 1
    if not dictionary[(M[1] + 1, M[2], M[3])] and M[1] + 1 < x:
        heapq.heappush(heap, (-(A[M[1] + 1] + B[M[2]] + C[M[3]]), M[1] + 1, M[2], M[3]))
        dictionary[(M[1] + 1, M[2], M[3])] = True
    if not dictionary[(M[1], M[2] + 1, M[3])] and M[2] + 1 < y:
        heapq.heappush(heap, (-(A[M[1]] + B[M[2] + 1] + C[M[3]]), M[1], M[2] + 1, M[3]))
        dictionary[(M[1], M[2] + 1, M[3])] = True
    if not dictionary[(M[1], M[2], M[3] + 1)] and M[3] + 1 < z:
        heapq.heappush(heap, (-(A[M[1]] + B[M[2]] + C[M[3] + 1]), M[1], M[2], M[3] + 1))
        dictionary[(M[1], M[2], M[3] + 1)] = True

from heapq import heappop, heappush, heapify

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()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
heap = list()
used = set()
res = list()
heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0))
used.add((0, 0, 0))
for _ in range(K):
    v, i, j, k = heappop(heap)
    res.append(-v)
    if i + 1 < X and (i + 1, j, k) not in used:
        used.add((i + 1, j, k))
        heappush(heap, (-(A[i + 1] + B[j] + C[k]), i + 1, j, k))
    if j + 1 < Y and (i, j + 1, k) not in used:
        used.add((i, j + 1, k))
        heappush(heap, (-(A[i] + B[j + 1] + C[k]), i, j + 1, k))
    if k + 1 < Z and (i, j, k + 1) not in used:
        used.add((i, j, k + 1))
        heappush(heap, (-(A[i] + B[j] + C[k + 1]), i, j, k + 1))
print(("\n".join(map(str, res))))

-import heapq -import collections +from heapq import heappop, heappush, heapify -x, y, z, k = list(map(int, input().split())) +X, Y, Z, K = list(map(int, input().split())) -heap = [] -heapq.heapify(heap) -heapq.heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0)) -dictionary = collections.defaultdict(bool) -dictionary[(0, 0, 0)] = True -i = 0 -while i < k: -    M = heapq.heappop(heap) -    print((-M[0])) -    i += 1 -    if not dictionary[(M[1] + 1, M[2], M[3])] and M[1] + 1 < x: -        heapq.heappush(heap, (-(A[M[1] + 1] + B[M[2]] + C[M[3]]), M[1] + 1, M[2], M[3])) -        dictionary[(M[1] + 1, M[2], M[3])] = True -    if not dictionary[(M[1], M[2] + 1, M[3])] and M[2] + 1 < y: -        heapq.heappush(heap, (-(A[M[1]] + B[M[2] + 1] + C[M[3]]), M[1], M[2] + 1, M[3])) -        dictionary[(M[1], M[2] + 1, M[3])] = True -    if not dictionary[(M[1], M[2], M[3] + 1)] and M[3] + 1 < z: -        heapq.heappush(heap, (-(A[M[1]] + B[M[2]] + C[M[3] + 1]), M[1], M[2], M[3] + 1)) -        dictionary[(M[1], M[2], M[3] + 1)] = True +heap = list() +used = set() +res = list() +heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0)) +used.add((0, 0, 0)) +for _ in range(K): +    v, i, j, k = heappop(heap) +    res.append(-v) +    if i + 1 < X and (i + 1, j, k) not in used: +        used.add((i + 1, j, k)) +        heappush(heap, (-(A[i + 1] + B[j] + C[k]), i + 1, j, k)) +    if j + 1 < Y and (i, j + 1, k) not in used: +        used.add((i, j + 1, k)) +        heappush(heap, (-(A[i] + B[j + 1] + C[k]), i, j + 1, k)) +    if k + 1 < Z and (i, j, k + 1) not in used: +        used.add((i, j, k + 1)) +        heappush(heap, (-(A[i] + B[j] + C[k + 1]), i, j, k + 1)) +print(("\n".join(map(str, res))))