from itertools import product

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()))

AB = [sum(ab) for ab in product(A, B)]

AB.sort(reverse=True)

AB = AB[:k]

ABC = [sum(abc) for abc in product(AB, C)]

ABC.sort(reverse=True)

for i in range(k):

    print((ABC[i]))

x, y, z, K = list(map(int, input().split()))

A = sorted(map(int, input().split()), reverse=True)

B = sorted(map(int, input().split()), reverse=True)

C = sorted(map(int, input().split()), reverse=True)

ans = []

for i in range(x):

    for j in range(y):

        for k in range(z):

            if (i+1)*(j+1)*(k+1) <= K:

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

                continue

            break

ans.sort(reverse=True)



for i in range(K):

    print((ans[i]))

from itertools import product

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()))
AB = [sum(ab) for ab in product(A, B)]
AB.sort(reverse=True)
AB = AB[:k]
ABC = [sum(abc) for abc in product(AB, C)]
ABC.sort(reverse=True)
for i in range(k):
    print((ABC[i]))

x, y, z, K = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
ans = []
for i in range(x):
    for j in range(y):
        for k in range(z):
            if (i + 1) * (j + 1) * (k + 1) <= K:
                ans.append(A[i] + B[j] + C[k])
                continue
            break
ans.sort(reverse=True)
for i in range(K):
    print((ans[i]))

-from itertools import product - -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())) -AB = [sum(ab) for ab in product(A, B)] -AB.sort(reverse=True) -AB = AB[:k] -ABC = [sum(abc) for abc in product(AB, C)] -ABC.sort(reverse=True) -for i in range(k): -    print((ABC[i])) +x, y, z, K = list(map(int, input().split())) +A = sorted(map(int, input().split()), reverse=True) +B = sorted(map(int, input().split()), reverse=True) +C = sorted(map(int, input().split()), reverse=True) +ans = [] +for i in range(x): +    for j in range(y): +        for k in range(z): +            if (i + 1) * (j + 1) * (k + 1) <= K: +                ans.append(A[i] + B[j] + C[k]) +                continue +            break +ans.sort(reverse=True) +for i in range(K): +    print((ans[i]))