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 = sorted([a+b for a,b in product(A,B)],reverse=True)[:K]

ans = sorted([a+b for a,b in product(AB,C)],reverse=True)[:K]

for i in ans:

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

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

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

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

num= []

for xi in range(1,X+1):

    for yi in range(1,Y+1):

        for zi in range(1,K//(xi*yi)+1):

            if xi*yi*zi <= K and zi < Z+1:

                num.append((xi-1,yi-1,zi-1))



ans = []

for a,b,c in num:

    ans.append(A[a]+B[b]+C[c])

ans.sort(reverse=1)

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 = sorted([a + b for a, b in product(A, B)], reverse=True)[:K]
ans = sorted([a + b for a, b in product(AB, C)], reverse=True)[:K]
for i in ans:
    print(i)

X, Y, Z, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=1)
B = sorted(list(map(int, input().split())), reverse=1)
C = sorted(list(map(int, input().split())), reverse=1)
num = []
for xi in range(1, X + 1):
    for yi in range(1, Y + 1):
        for zi in range(1, K // (xi * yi) + 1):
            if xi * yi * zi <= K and zi < Z + 1:
                num.append((xi - 1, yi - 1, zi - 1))
ans = []
for a, b, c in num:
    ans.append(A[a] + B[b] + C[c])
ans.sort(reverse=1)
for i in range(K):
    print((ans[i]))

-from itertools import product - -A = list(map(int, input().split())) -B = list(map(int, input().split())) -C = list(map(int, input().split())) -AB = sorted([a + b for a, b in product(A, B)], reverse=True)[:K] -ans = sorted([a + b for a, b in product(AB, C)], reverse=True)[:K] -for i in ans: -    print(i) +A = sorted(list(map(int, input().split())), reverse=1) +B = sorted(list(map(int, input().split())), reverse=1) +C = sorted(list(map(int, input().split())), reverse=1) +num = [] +for xi in range(1, X + 1): +    for yi in range(1, Y + 1): +        for zi in range(1, K // (xi * yi) + 1): +            if xi * yi * zi <= K and zi < Z + 1: +                num.append((xi - 1, yi - 1, zi - 1)) +ans = [] +for a, b, c in num: +    ans.append(A[a] + B[b] + C[c]) +ans.sort(reverse=1) +for i in range(K): +    print((ans[i]))