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

A = [int(x) for x in input().split()]

B = [int(x) for x in input().split()]

C = [int(x) for x in input().split()]



A.sort(reverse=True)

B.sort(reverse=True)

C.sort(reverse=True)



D = []

for i in range(X):

    for j in range(Y):

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

            break

        for k in range(Z):

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

                break

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

D.sort(reverse=True)

D = D[:K]

for d in D:

    print(d)

import heapq



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

A = [int(x) for x in input().split()] + [float('-inf')]

B = [int(x) for x in input().split()] + [float('-inf')]

C = [int(x) for x in input().split()] + [float('-inf')]



A.sort(reverse=True)

B.sort(reverse=True)

C.sort(reverse=True)





def f(i, j, k):

    x = A[i] + B[j] + C[k]

    return (-x, (i, j, k))





hq = []

heapq.heappush(hq, f(0, 0, 0))



ans = []

memo = set()

while len(ans) < K:

    v, (i, j, k) = heapq.heappop(hq)

    ans.append(-v)



    for x in range(3):

        a, b, c = i, j, k

        if x == 0:

            a += 1

        elif x == 1:

            b += 1

        else:

            c += 1

        v = (a << 20) + (b << 10) + c

        if v not in memo:

            heapq.heappush(hq, f(a, b, c))

            memo.add(v)



for x in ans:

    print(x)

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

import heapq

X, Y, Z, K = list(map(int, input().split()))
A = [int(x) for x in input().split()] + [float("-inf")]
B = [int(x) for x in input().split()] + [float("-inf")]
C = [int(x) for x in input().split()] + [float("-inf")]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)


def f(i, j, k):
    x = A[i] + B[j] + C[k]
    return (-x, (i, j, k))


hq = []
heapq.heappush(hq, f(0, 0, 0))
ans = []
memo = set()
while len(ans) < K:
    v, (i, j, k) = heapq.heappop(hq)
    ans.append(-v)
    for x in range(3):
        a, b, c = i, j, k
        if x == 0:
            a += 1
        elif x == 1:
            b += 1
        else:
            c += 1
        v = (a << 20) + (b << 10) + c
        if v not in memo:
            heapq.heappush(hq, f(a, b, c))
            memo.add(v)
for x in ans:
    print(x)

+import heapq + -A = [int(x) for x in input().split()] -B = [int(x) for x in input().split()] -C = [int(x) for x in input().split()] +A = [int(x) for x in input().split()] + [float("-inf")] +B = [int(x) for x in input().split()] + [float("-inf")] +C = [int(x) for x in input().split()] + [float("-inf")] -D = [] -for i in range(X): -    for j in range(Y): -        if (i + 1) * (j + 1) > K: -            break -        for k in range(Z): -            if (i + 1) * (j + 1) * (k + 1) > K: -                break -            D.append(A[i] + B[j] + C[k]) -D.sort(reverse=True) -D = D[:K] -for d in D: -    print(d) + + +def f(i, j, k): +    x = A[i] + B[j] + C[k] +    return (-x, (i, j, k)) + + +hq = [] +heapq.heappush(hq, f(0, 0, 0)) +ans = [] +memo = set() +while len(ans) < K: +    v, (i, j, k) = heapq.heappop(hq) +    ans.append(-v) +    for x in range(3): +        a, b, c = i, j, k +        if x == 0: +            a += 1 +        elif x == 1: +            b += 1 +        else: +            c += 1 +        v = (a << 20) + (b << 10) + c +        if v not in memo: +            heapq.heappush(hq, f(a, b, c)) +            memo.add(v) +for x in ans: +    print(x)