import sys

input = sys.stdin.readline



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)



res = []



for i in range(X):

    for j in range(Y):

        sup = min(K //((i+1)*(j+1)),Z)

        for k in range(sup):

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



res.sort(reverse=True)



for ans in res[:K]:

    print(ans)
from heapq import heappush, heappop



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

A = sorted(list(map(int,input().split())),reverse=True)

B = sorted(list(map(int,input().split())),reverse=True)

C = sorted(list(map(int,input().split())),reverse=True)



ans_list = []

s = set()

pq = []

item = (-(A[0]+B[0]+C[0]),0,0,0)

heappush(pq,item)



for _ in range(K):

    value, i, j, k = heappop(pq)

    ans_list.append(-value)

    if len(ans_list) == K:

        break

    if i <= X-2 and (i+1,j,k) not in s:

        item = (-(A[i+1]+B[j]+C[k]),i+1,j,k)

        heappush(pq,item)

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

    if j <= Y-2 and (i,j+1,k) not in s:

        item = (-(A[i]+B[j+1]+C[k]),i,j+1,k)

        heappush(pq,item)

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

    if k <= Z-2 and (i,j,k+1) not in s:

        item = (-(A[i]+B[j]+C[k+1]),i,j,k+1)

        heappush(pq,item)

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



for ans in ans_list:

    print(ans)
import sys

input = sys.stdin.readline
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)
res = []
for i in range(X):
    for j in range(Y):
        sup = min(K // ((i + 1) * (j + 1)), Z)
        for k in range(sup):
            res.append(A[i] + B[j] + C[k])
res.sort(reverse=True)
for ans in res[:K]:
    print(ans)

from heapq import heappush, heappop

X, Y, Z, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
ans_list = []
s = set()
pq = []
item = (-(A[0] + B[0] + C[0]), 0, 0, 0)
heappush(pq, item)
for _ in range(K):
    value, i, j, k = heappop(pq)
    ans_list.append(-value)
    if len(ans_list) == K:
        break
    if i <= X - 2 and (i + 1, j, k) not in s:
        item = (-(A[i + 1] + B[j] + C[k]), i + 1, j, k)
        heappush(pq, item)
        s.add((i + 1, j, k))
    if j <= Y - 2 and (i, j + 1, k) not in s:
        item = (-(A[i] + B[j + 1] + C[k]), i, j + 1, k)
        heappush(pq, item)
        s.add((i, j + 1, k))
    if k <= Z - 2 and (i, j, k + 1) not in s:
        item = (-(A[i] + B[j] + C[k + 1]), i, j, k + 1)
        heappush(pq, item)
        s.add((i, j, k + 1))
for ans in ans_list:
    print(ans)

-import sys +from heapq import heappush, heappop -input = sys.stdin.readline -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) -res = [] -for i in range(X): -    for j in range(Y): -        sup = min(K // ((i + 1) * (j + 1)), Z) -        for k in range(sup): -            res.append(A[i] + B[j] + C[k]) -res.sort(reverse=True) -for ans in res[:K]: +A = sorted(list(map(int, input().split())), reverse=True) +B = sorted(list(map(int, input().split())), reverse=True) +C = sorted(list(map(int, input().split())), reverse=True) +ans_list = [] +s = set() +pq = [] +item = (-(A[0] + B[0] + C[0]), 0, 0, 0) +heappush(pq, item) +for _ in range(K): +    value, i, j, k = heappop(pq) +    ans_list.append(-value) +    if len(ans_list) == K: +        break +    if i <= X - 2 and (i + 1, j, k) not in s: +        item = (-(A[i + 1] + B[j] + C[k]), i + 1, j, k) +        heappush(pq, item) +        s.add((i + 1, j, k)) +    if j <= Y - 2 and (i, j + 1, k) not in s: +        item = (-(A[i] + B[j + 1] + C[k]), i, j + 1, k) +        heappush(pq, item) +        s.add((i, j + 1, k)) +    if k <= Z - 2 and (i, j, k + 1) not in s: +        item = (-(A[i] + B[j] + C[k + 1]), i, j, k + 1) +        heappush(pq, item) +        s.add((i, j, k + 1)) +for ans in ans_list: