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

import heapq



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



Q = []

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

registered = set()

registered.add((0, 0, 0))

for _ in range(K):

    s, ai, bi, ci = heapq.heappop(Q)

    print((-s))



    if ai+1 < X and (ai+1, bi, ci) not in registered:

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

        registered.add((ai+1, bi, ci))

    if bi+1 < Y and (ai, bi+1, ci) not in registered:

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

        registered.add((ai, bi+1, ci))

    if ci+1 < Z and (ai, bi, ci+1) not in registered:

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

        registered.add((ai, bi, ci+1))

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

import heapq

X, Y, Z, K = list(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)
Q = []
heapq.heappush(Q, (-1 * (A[0] + B[0] + C[0]), 0, 0, 0))
registered = set()
registered.add((0, 0, 0))
for _ in range(K):
    s, ai, bi, ci = heapq.heappop(Q)
    print((-s))
    if ai + 1 < X and (ai + 1, bi, ci) not in registered:
        heapq.heappush(Q, (-1 * (A[ai + 1] + B[bi] + C[ci]), ai + 1, bi, ci))
        registered.add((ai + 1, bi, ci))
    if bi + 1 < Y and (ai, bi + 1, ci) not in registered:
        heapq.heappush(Q, (-1 * (A[ai] + B[bi + 1] + C[ci]), ai, bi + 1, ci))
        registered.add((ai, bi + 1, ci))
    if ci + 1 < Z and (ai, bi, ci + 1) not in registered:
        heapq.heappush(Q, (-1 * (A[ai] + B[bi] + C[ci + 1]), ai, bi, ci + 1))
        registered.add((ai, bi, ci + 1))

-import itertools +import heapq -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 = list(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) +Q = [] +heapq.heappush(Q, (-1 * (A[0] + B[0] + C[0]), 0, 0, 0)) +registered = set() +registered.add((0, 0, 0)) +for _ in range(K): +    s, ai, bi, ci = heapq.heappop(Q) +    print((-s)) +    if ai + 1 < X and (ai + 1, bi, ci) not in registered: +        heapq.heappush(Q, (-1 * (A[ai + 1] + B[bi] + C[ci]), ai + 1, bi, ci)) +        registered.add((ai + 1, bi, ci)) +    if bi + 1 < Y and (ai, bi + 1, ci) not in registered: +        heapq.heappush(Q, (-1 * (A[ai] + B[bi + 1] + C[ci]), ai, bi + 1, ci)) +        registered.add((ai, bi + 1, ci)) +    if ci + 1 < Z and (ai, bi, ci + 1) not in registered: +        heapq.heappush(Q, (-1 * (A[ai] + B[bi] + C[ci + 1]), ai, bi, ci + 1)) +        registered.add((ai, bi, ci + 1))