import itertools



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

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

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

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



comb_ab = []

for a, b in itertools.product(A, B):

    comb_ab.append(sum([a, b]))



comb_ab_top = sorted(comb_ab, reverse=True)[:K]



comb_abc = []

for ab, c in itertools.product(comb_ab_top, C):

    comb_abc.append(sum([ab, c]))



ans = sorted(comb_abc, reverse=True)[:K]

print(*ans, sep='\n')

X, Y, Z, K = 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)



comb = []

for a in range(X):

    b_max = K // (a+1)

    for b in range(min(Y, b_max)):

        c_max = K // ((a+1)*(b+1))

        for c in range(min(Z, c_max)):

            comb.append(sum([A[a], B[b], C[c]]))



comb.sort(reverse=True)



print(*comb[:K], sep='\n')

import itertools

X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
comb_ab = []
for a, b in itertools.product(A, B):
    comb_ab.append(sum([a, b]))
comb_ab_top = sorted(comb_ab, reverse=True)[:K]
comb_abc = []
for ab, c in itertools.product(comb_ab_top, C):
    comb_abc.append(sum([ab, c]))
ans = sorted(comb_abc, reverse=True)[:K]
print(*ans, sep="\n")

X, Y, Z, K = 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)
comb = []
for a in range(X):
    b_max = K // (a + 1)
    for b in range(min(Y, b_max)):
        c_max = K // ((a + 1) * (b + 1))
        for c in range(min(Z, c_max)):
            comb.append(sum([A[a], B[b], C[c]]))
comb.sort(reverse=True)
print(*comb[:K], sep="\n")

-import itertools - -A = sorted(list(map(int, input().split()))) -B = sorted(list(map(int, input().split()))) -C = sorted(list(map(int, input().split()))) -comb_ab = [] -for a, b in itertools.product(A, B): -    comb_ab.append(sum([a, b])) -comb_ab_top = sorted(comb_ab, reverse=True)[:K] -comb_abc = [] -for ab, c in itertools.product(comb_ab_top, C): -    comb_abc.append(sum([ab, c])) -ans = sorted(comb_abc, reverse=True)[:K] -print(*ans, sep="\n") +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) +comb = [] +for a in range(X): +    b_max = K // (a + 1) +    for b in range(min(Y, b_max)): +        c_max = K // ((a + 1) * (b + 1)) +        for c in range(min(Z, c_max)): +            comb.append(sum([A[a], B[b], C[c]])) +comb.sort(reverse=True) +print(*comb[:K], sep="\n")