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

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

A.sort(reverse=True)

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

B.sort(reverse=True)

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

C.sort(reverse=True)



ABC=[]

for i in range(X):

    for j in range(Y):

        for k in range(Z):

            if (i+1)*(j+1)*(k+1)<=K:

                ABC.append(A[i] + B[j] + C[k])

            else:

                break



ABC.sort(reverse=True)



for i in range(K):

    print((ABC[i]))
import heapq

hq=[]

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

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

A.sort(reverse=True)

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

B.sort(reverse=True)

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

C.sort(reverse=True)

searched={(0,0,0)}

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

D=[[1,0,0],[0,1,0],[0,0,1]]



for _ in range(K):

    abc,x,y,z=heapq.heappop(hq)

    print((-abc))

    for dx,dy,dz in D:

        if x+dx<X and y+dy < Y and z+dz < Z and (x+dx,y+dy,z+dz) not in searched:

            heapq.heappush(hq,(-(A[x+dx]+B[y+dy]+C[z+dz]),x+dx,y+dy,z+dz))

            searched.add((x+dx,y+dy,z+dz))
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)
ABC = []
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i + 1) * (j + 1) * (k + 1) <= K:
                ABC.append(A[i] + B[j] + C[k])
            else:
                break
ABC.sort(reverse=True)
for i in range(K):
    print((ABC[i]))

import heapq

hq = []
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)
searched = {(0, 0, 0)}
heapq.heappush(hq, (-(A[0] + B[0] + C[0]), 0, 0, 0))
D = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
for _ in range(K):
    abc, x, y, z = heapq.heappop(hq)
    print((-abc))
    for dx, dy, dz in D:
        if (
            x + dx < X
            and y + dy < Y
            and z + dz < Z
            and (x + dx, y + dy, z + dz) not in searched
        ):
            heapq.heappush(
                hq, (-(A[x + dx] + B[y + dy] + C[z + dz]), x + dx, y + dy, z + dz)
            )
            searched.add((x + dx, y + dy, z + dz))

+import heapq + +hq = [] -ABC = [] -for i in range(X): -    for j in range(Y): -        for k in range(Z): -            if (i + 1) * (j + 1) * (k + 1) <= K: -                ABC.append(A[i] + B[j] + C[k]) -            else: -                break -ABC.sort(reverse=True) -for i in range(K): -    print((ABC[i])) +searched = {(0, 0, 0)} +heapq.heappush(hq, (-(A[0] + B[0] + C[0]), 0, 0, 0)) +D = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] +for _ in range(K): +    abc, x, y, z = heapq.heappop(hq) +    print((-abc)) +    for dx, dy, dz in D: +        if ( +            x + dx < X +            and y + dy < Y +            and z + dz < Z +            and (x + dx, y + dy, z + dz) not in searched +        ): +            heapq.heappush( +                hq, (-(A[x + dx] + B[y + dy] + C[z + dz]), x + dx, y + dy, z + dz) +            ) +            searched.add((x + dx, y + dy, z + dz))