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

for x in range(X):

    if x+1 > K:

        break

    for y in range(Y):

        if (x+1) * (y+1) > K:

            break

        for z in range(Z):

            if (x+1) * (y+1) * (z+1) > K:

                break



            value = A[x] + B[y] + C[z]

            ans.append(value)



ans.sort(reverse=True)

for i in range(K):

    print((ans[i]))

import heapq



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)



used = set()

candidate = []

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



for _ in range(K):

    value, x, y, z = heapq.heappop(candidate)

    print((-value))



    if x+1 < X and (x+1, y, z) not in used:

        heapq.heappush(candidate, (-A[x+1]-B[y]-C[z], x+1, y, z))

        used.add((x+1, y, z))



    if y+1 < Y and (x, y+1, z) not in used:

        heapq.heappush(candidate, (-A[x]-B[y+1]-C[z], x, y+1, z))

        used.add((x, y+1, z))



    if z+1 < Z and (x, y, z+1) not in used:

        heapq.heappush(candidate, (-A[x]-B[y]-C[z+1], x , y, z+1))

        used.add((x, y, z+1))
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 = []
for x in range(X):
    if x + 1 > K:
        break
    for y in range(Y):
        if (x + 1) * (y + 1) > K:
            break
        for z in range(Z):
            if (x + 1) * (y + 1) * (z + 1) > K:
                break
            value = A[x] + B[y] + C[z]
            ans.append(value)
ans.sort(reverse=True)
for i in range(K):
    print((ans[i]))

import heapq

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)
used = set()
candidate = []
heapq.heappush(candidate, (-A[0] - B[0] - C[0], 0, 0, 0))
for _ in range(K):
    value, x, y, z = heapq.heappop(candidate)
    print((-value))
    if x + 1 < X and (x + 1, y, z) not in used:
        heapq.heappush(candidate, (-A[x + 1] - B[y] - C[z], x + 1, y, z))
        used.add((x + 1, y, z))
    if y + 1 < Y and (x, y + 1, z) not in used:
        heapq.heappush(candidate, (-A[x] - B[y + 1] - C[z], x, y + 1, z))
        used.add((x, y + 1, z))
    if z + 1 < Z and (x, y, z + 1) not in used:
        heapq.heappush(candidate, (-A[x] - B[y] - C[z + 1], x, y, z + 1))
        used.add((x, y, z + 1))

+import heapq + -ans = [] -for x in range(X): -    if x + 1 > K: -        break -    for y in range(Y): -        if (x + 1) * (y + 1) > K: -            break -        for z in range(Z): -            if (x + 1) * (y + 1) * (z + 1) > K: -                break -            value = A[x] + B[y] + C[z] -            ans.append(value) -ans.sort(reverse=True) -for i in range(K): -    print((ans[i])) +used = set() +candidate = [] +heapq.heappush(candidate, (-A[0] - B[0] - C[0], 0, 0, 0)) +for _ in range(K): +    value, x, y, z = heapq.heappop(candidate) +    print((-value)) +    if x + 1 < X and (x + 1, y, z) not in used: +        heapq.heappush(candidate, (-A[x + 1] - B[y] - C[z], x + 1, y, z)) +        used.add((x + 1, y, z)) +    if y + 1 < Y and (x, y + 1, z) not in used: +        heapq.heappush(candidate, (-A[x] - B[y + 1] - C[z], x, y + 1, z)) +        used.add((x, y + 1, z)) +    if z + 1 < Z and (x, y, z + 1) not in used: +        heapq.heappush(candidate, (-A[x] - B[y] - C[z + 1], x, y, z + 1)) +        used.add((x, y, z + 1))