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

A = sorted([int(i) for i in input().split()], reverse=True)

B = sorted([int(i) for i in input().split()], reverse=True)

C = sorted([int(i) for i in input().split()], reverse=True)

D = []

for i in range(min(K, X)):

    for j in range(min(K, Y)):

        if (i + 1) * (j + 1) > K:

            break

        for k in range(min(K, Z)):

            if (i + 1) * (j + 1) * (k + 1) > K:

                break

            else:



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



D.sort(reverse=True)

for i in range(K):

    print((D[i]))
import heapq



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

A = sorted([int(i) for i in input().split()], reverse=True)

B = sorted([int(i) for i in input().split()], reverse=True)

C = sorted([int(i) for i in input().split()], reverse=True)

Q = []

dic = {}

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

i = 0

while i < K and len(Q) > 0:

    t = heapq.heappop(Q)

    print((-t[0]))

    a, b, c = t[1:]

    if a + 1 < X and (a + 2) * (b + 1) * (c + 1) <= K and not (a + 1, b, c) in list(dic.keys()):

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

        dic[(a + 1, b, c)] = 1

    if b + 1 < Y and (a + 1) * (b + 2) * (c + 1) <= K and not (a, b + 1, c) in list(dic.keys()):

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

        dic[(a, b + 1, c)] = 1

    if c + 1 < Z and (a + 1) * (b + 1) * (c + 2) <= K and not (a, b, c + 1) in list(dic.keys()):

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

        dic[(a, b, c + 1)] = 1

    i += 1



X, Y, Z, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
D = []
for i in range(min(K, X)):
    for j in range(min(K, Y)):
        if (i + 1) * (j + 1) > K:
            break
        for k in range(min(K, Z)):
            if (i + 1) * (j + 1) * (k + 1) > K:
                break
            else:
                D.append(A[i] + B[j] + C[k])
D.sort(reverse=True)
for i in range(K):
    print((D[i]))

import heapq

X, Y, Z, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
Q = []
dic = {}
heapq.heappush(Q, (-(A[0] + B[0] + C[0]), 0, 0, 0))
i = 0
while i < K and len(Q) > 0:
    t = heapq.heappop(Q)
    print((-t[0]))
    a, b, c = t[1:]
    if (
        a + 1 < X
        and (a + 2) * (b + 1) * (c + 1) <= K
        and not (a + 1, b, c) in list(dic.keys())
    ):
        heapq.heappush(Q, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c))
        dic[(a + 1, b, c)] = 1
    if (
        b + 1 < Y
        and (a + 1) * (b + 2) * (c + 1) <= K
        and not (a, b + 1, c) in list(dic.keys())
    ):
        heapq.heappush(Q, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c))
        dic[(a, b + 1, c)] = 1
    if (
        c + 1 < Z
        and (a + 1) * (b + 1) * (c + 2) <= K
        and not (a, b, c + 1) in list(dic.keys())
    ):
        heapq.heappush(Q, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1))
        dic[(a, b, c + 1)] = 1
    i += 1

+import heapq + -D = [] -for i in range(min(K, X)): -    for j in range(min(K, Y)): -        if (i + 1) * (j + 1) > K: -            break -        for k in range(min(K, Z)): -            if (i + 1) * (j + 1) * (k + 1) > K: -                break -            else: -                D.append(A[i] + B[j] + C[k]) -D.sort(reverse=True) -for i in range(K): -    print((D[i])) +Q = [] +dic = {} +heapq.heappush(Q, (-(A[0] + B[0] + C[0]), 0, 0, 0)) +i = 0 +while i < K and len(Q) > 0: +    t = heapq.heappop(Q) +    print((-t[0])) +    a, b, c = t[1:] +    if ( +        a + 1 < X +        and (a + 2) * (b + 1) * (c + 1) <= K +        and not (a + 1, b, c) in list(dic.keys()) +    ): +        heapq.heappush(Q, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c)) +        dic[(a + 1, b, c)] = 1 +    if ( +        b + 1 < Y +        and (a + 1) * (b + 2) * (c + 1) <= K +        and not (a, b + 1, c) in list(dic.keys()) +    ): +        heapq.heappush(Q, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c)) +        dic[(a, b + 1, c)] = 1 +    if ( +        c + 1 < Z +        and (a + 1) * (b + 1) * (c + 2) <= K +        and not (a, b, c + 1) in list(dic.keys()) +    ): +        heapq.heappush(Q, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1)) +        dic[(a, b, c + 1)] = 1 +    i += 1