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

AB=[]

for a in A:

    for b in B:

        AB.append(a+b)

AB.sort(reverse=True)

AB=AB[:k]

ABC=[]

for ab in AB:

    for c in C:

        ABC.append(ab+c)

ABC.sort(reverse=True)

for i in range(k):

    print((ABC[i]))
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()))

A.sort(reverse=True);B.sort(reverse=True);C.sort(reverse=True)

hq=[]

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

searched={(0,0,0)}

a,b,c=0,0,0

D=((1,0,0),(0,1,0),(0,0,1))

for _ in range(k):

    abc,a,b,c=heapq.heappop(hq)

    print((-abc))

    for dx,dy,dz in D:

        if not (a+dx,b+dy,c+dz) in searched:

            if a+dx<x and b+dy<y and c+dz<z:

                heapq.heappush(hq,(-(A[a+dx]+B[b+dy]+C[c+dz]),a+dx,b+dy,c+dz))

                searched.add((a+dx,b+dy,c+dz))
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()))
AB = []
for a in A:
    for b in B:
        AB.append(a + b)
AB.sort(reverse=True)
AB = AB[:k]
ABC = []
for ab in AB:
    for c in C:
        ABC.append(ab + c)
ABC.sort(reverse=True)
for i in range(k):
    print((ABC[i]))

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()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
hq = []
heapq.heappush(hq, (-(A[0] + B[0] + C[0]), 0, 0, 0))
searched = {(0, 0, 0)}
a, b, c = 0, 0, 0
D = ((1, 0, 0), (0, 1, 0), (0, 0, 1))
for _ in range(k):
    abc, a, b, c = heapq.heappop(hq)
    print((-abc))
    for dx, dy, dz in D:
        if not (a + dx, b + dy, c + dz) in searched:
            if a + dx < x and b + dy < y and c + dz < z:
                heapq.heappush(
                    hq, (-(A[a + dx] + B[b + dy] + C[c + dz]), a + dx, b + dy, c + dz)
                )
                searched.add((a + dx, b + dy, c + dz))

+import heapq + -AB = [] -for a in A: -    for b in B: -        AB.append(a + b) -AB.sort(reverse=True) -AB = AB[:k] -ABC = [] -for ab in AB: -    for c in C: -        ABC.append(ab + c) -ABC.sort(reverse=True) -for i in range(k): -    print((ABC[i])) +A.sort(reverse=True) +B.sort(reverse=True) +C.sort(reverse=True) +hq = [] +heapq.heappush(hq, (-(A[0] + B[0] + C[0]), 0, 0, 0)) +searched = {(0, 0, 0)} +a, b, c = 0, 0, 0 +D = ((1, 0, 0), (0, 1, 0), (0, 0, 1)) +for _ in range(k): +    abc, a, b, c = heapq.heappop(hq) +    print((-abc)) +    for dx, dy, dz in D: +        if not (a + dx, b + dy, c + dz) in searched: +            if a + dx < x and b + dy < y and c + dz < z: +                heapq.heappush( +                    hq, (-(A[a + dx] + B[b + dy] + C[c + dz]), a + dx, b + dy, c + dz) +                ) +                searched.add((a + dx, b + dy, c + dz))