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_b = []

for i in range(X):

    for j in range(Y):

        a_b.append(A[i]+B[j])

a_b = sorted(a_b, reverse=True)

ans = []

for k in range(min(K, len(a_b))):

    for l in range(min(K, len(C))):

        ans.append(a_b[k]+C[l])

ans = sorted(ans, reverse=True)

for m in range(K):

    print((ans[m]))

# 優先度付き待ち行列で解く

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 = sorted(A, reverse=True)

B = sorted(B, reverse=True)

C = sorted(C, reverse=True)

A.append(-10**20)

B.append(-10**20)

C.append(-10**20)

Q = []

heapq.heapify(Q)

heapq.heappush(Q, (-(A[0]+B[0]+C[0]), 0, 0, 0))  # ケーキの美味しさ, Aのindex, Bのindex, Cのindex

count = 0

fin = {}

while count < K:

    delicious, a, b, c = heapq.heappop(Q)

    if (a, b, c) not in fin:

        fin[(a, b, c)] = True

        print((-delicious))

        heapq.heappush(Q, (-(A[a+1]+B[b]+C[c]), a+1, b, c))

        heapq.heappush(Q, (-(A[a]+B[b+1]+C[c]), a, b+1, c))

        heapq.heappush(Q, (-(A[a]+B[b]+C[c+1]), a, b, c+1))

        count += 1

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_b = []
for i in range(X):
    for j in range(Y):
        a_b.append(A[i] + B[j])
a_b = sorted(a_b, reverse=True)
ans = []
for k in range(min(K, len(a_b))):
    for l in range(min(K, len(C))):
        ans.append(a_b[k] + C[l])
ans = sorted(ans, reverse=True)
for m in range(K):
    print((ans[m]))

# 優先度付き待ち行列で解く
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 = sorted(A, reverse=True)
B = sorted(B, reverse=True)
C = sorted(C, reverse=True)
A.append(-(10**20))
B.append(-(10**20))
C.append(-(10**20))
Q = []
heapq.heapify(Q)
heapq.heappush(
    Q, (-(A[0] + B[0] + C[0]), 0, 0, 0)
)  # ケーキの美味しさ, Aのindex, Bのindex, Cのindex
count = 0
fin = {}
while count < K:
    delicious, a, b, c = heapq.heappop(Q)
    if (a, b, c) not in fin:
        fin[(a, b, c)] = True
        print((-delicious))
        heapq.heappush(Q, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c))
        heapq.heappush(Q, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c))
        heapq.heappush(Q, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1))
        count += 1

+# 優先度付き待ち行列で解く +import heapq + -a_b = [] -for i in range(X): -    for j in range(Y): -        a_b.append(A[i] + B[j]) -a_b = sorted(a_b, reverse=True) -ans = [] -for k in range(min(K, len(a_b))): -    for l in range(min(K, len(C))): -        ans.append(a_b[k] + C[l]) -ans = sorted(ans, reverse=True) -for m in range(K): -    print((ans[m])) +A = sorted(A, reverse=True) +B = sorted(B, reverse=True) +C = sorted(C, reverse=True) +A.append(-(10**20)) +B.append(-(10**20)) +C.append(-(10**20)) +Q = [] +heapq.heapify(Q) +heapq.heappush( +    Q, (-(A[0] + B[0] + C[0]), 0, 0, 0) +)  # ケーキの美味しさ, Aのindex, Bのindex, Cのindex +count = 0 +fin = {} +while count < K: +    delicious, a, b, c = heapq.heappop(Q) +    if (a, b, c) not in fin: +        fin[(a, b, c)] = True +        print((-delicious)) +        heapq.heappush(Q, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c)) +        heapq.heappush(Q, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c)) +        heapq.heappush(Q, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1)) +        count += 1