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)



ABC = []



for i, a in enumerate(A):

    for j, b in enumerate(B):

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

            break

        for k, c in enumerate(C):

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

                break

            ABC.append(a + b + c)



ABC.sort(reverse=True)

for i in range(K):

    print((ABC[i]))
import heapq

used = {}





def is_used(a, b, c):

    hash = (a, b, c)

    ret = hash in used

    used[hash] = 1

    return ret





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)



la = len(A)

lb = len(B)

lc = len(C)



Q = []

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



ans = []

while len(ans) < K:

    q = heapq.heappop(Q)

    ans.append(-q[0])

    if q[1] != la - 1:

        ai = q[1] + 1

        bi = q[2]

        ci = q[3]

        if not is_used(ai, bi, ci):

            heapq.heappush(Q, (-(A[ai] + B[bi] + C[ci]), ai, bi, ci))

    if q[2] != lb - 1:

        ai = q[1]

        bi = q[2] + 1

        ci = q[3]

        if not is_used(ai, bi, ci):

            heapq.heappush(Q, (-(A[ai] + B[bi] + C[ci]), ai, bi, ci))

    if q[3] != lc - 1:

        ai = q[1]

        bi = q[2]

        ci = q[3] + 1

        if not is_used(ai, bi, ci):

            heapq.heappush(Q, (-(A[ai] + B[bi] + C[ci]), ai, bi, ci))



for i, a in enumerate(ans):

    print(a)
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)
ABC = []
for i, a in enumerate(A):
    for j, b in enumerate(B):
        if (i + 1) * (j + 1) > K:
            break
        for k, c in enumerate(C):
            if (i + 1) * (j + 1) * (k + 1) > K:
                break
            ABC.append(a + b + c)
ABC.sort(reverse=True)
for i in range(K):
    print((ABC[i]))

import heapq

used = {}


def is_used(a, b, c):
    hash = (a, b, c)
    ret = hash in used
    used[hash] = 1
    return ret


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)
la = len(A)
lb = len(B)
lc = len(C)
Q = []
heapq.heappush(Q, (-(A[0] + B[0] + C[0]), 0, 0, 0))
ans = []
while len(ans) < K:
    q = heapq.heappop(Q)
    ans.append(-q[0])
    if q[1] != la - 1:
        ai = q[1] + 1
        bi = q[2]
        ci = q[3]
        if not is_used(ai, bi, ci):
            heapq.heappush(Q, (-(A[ai] + B[bi] + C[ci]), ai, bi, ci))
    if q[2] != lb - 1:
        ai = q[1]
        bi = q[2] + 1
        ci = q[3]
        if not is_used(ai, bi, ci):
            heapq.heappush(Q, (-(A[ai] + B[bi] + C[ci]), ai, bi, ci))
    if q[3] != lc - 1:
        ai = q[1]
        bi = q[2]
        ci = q[3] + 1
        if not is_used(ai, bi, ci):
            heapq.heappush(Q, (-(A[ai] + B[bi] + C[ci]), ai, bi, ci))
for i, a in enumerate(ans):
    print(a)

+import heapq + +used = {} + + +def is_used(a, b, c): +    hash = (a, b, c) +    ret = hash in used +    used[hash] = 1 +    return ret + + -ABC = [] -for i, a in enumerate(A): -    for j, b in enumerate(B): -        if (i + 1) * (j + 1) > K: -            break -        for k, c in enumerate(C): -            if (i + 1) * (j + 1) * (k + 1) > K: -                break -            ABC.append(a + b + c) -ABC.sort(reverse=True) -for i in range(K): -    print((ABC[i])) +la = len(A) +lb = len(B) +lc = len(C) +Q = [] +heapq.heappush(Q, (-(A[0] + B[0] + C[0]), 0, 0, 0)) +ans = [] +while len(ans) < K: +    q = heapq.heappop(Q) +    ans.append(-q[0]) +    if q[1] != la - 1: +        ai = q[1] + 1 +        bi = q[2] +        ci = q[3] +        if not is_used(ai, bi, ci): +            heapq.heappush(Q, (-(A[ai] + B[bi] + C[ci]), ai, bi, ci)) +    if q[2] != lb - 1: +        ai = q[1] +        bi = q[2] + 1 +        ci = q[3] +        if not is_used(ai, bi, ci): +            heapq.heappush(Q, (-(A[ai] + B[bi] + C[ci]), ai, bi, ci)) +    if q[3] != lc - 1: +        ai = q[1] +        bi = q[2] +        ci = q[3] + 1 +        if not is_used(ai, bi, ci): +            heapq.heappush(Q, (-(A[ai] + B[bi] + C[ci]), ai, bi, ci)) +for i, a in enumerate(ans): +    print(a)