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 = []

for a in A:

	for b in B:

		ab += [a + b]



ab3000 = sorted(ab)[::-1][:3000]



abc = []

for ab in ab3000:

	for c in C:

		abc += [ab + c]



abc.sort(reverse=True)



for k in range(K):

	print((abc[k]))

import heapq



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



a = sorted(A, reverse=True)

b = sorted(B, reverse=True)

c = sorted(C, reverse=True)



added = [(0, 0, 0)]

cakes = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]

for k in range(K):

	v = heapq.heappop(cakes)

	print((-v[0]))

	va, vb, vc = v[1:]

	if va < X - 1 and (va + 1, vb, vc) not in added:

		heapq.heappush(cakes, (-(a[va + 1] + b[vb] + c[vc]), va + 1, vb, vc))

		added += [(va + 1, vb, vc)]

	if vb < Y - 1 and (va, vb + 1, vc) not in added:

		heapq.heappush(cakes, (-(a[va] + b[vb + 1] + c[vc]), va, vb + 1, vc))

		added += [(va, vb + 1, vc)]

	if vc < Z - 1 and (va, vb, vc + 1) not in added:

		heapq.heappush(cakes, (-(a[va] + b[vb] + c[vc + 1]), va, vb, vc + 1))

		added += [(va, vb, vc + 1)]

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 = []
for a in A:
    for b in B:
        ab += [a + b]
ab3000 = sorted(ab)[::-1][:3000]
abc = []
for ab in ab3000:
    for c in C:
        abc += [ab + c]
abc.sort(reverse=True)
for k in range(K):
    print((abc[k]))

import heapq

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()))
a = sorted(A, reverse=True)
b = sorted(B, reverse=True)
c = sorted(C, reverse=True)
added = [(0, 0, 0)]
cakes = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]
for k in range(K):
    v = heapq.heappop(cakes)
    print((-v[0]))
    va, vb, vc = v[1:]
    if va < X - 1 and (va + 1, vb, vc) not in added:
        heapq.heappush(cakes, (-(a[va + 1] + b[vb] + c[vc]), va + 1, vb, vc))
        added += [(va + 1, vb, vc)]
    if vb < Y - 1 and (va, vb + 1, vc) not in added:
        heapq.heappush(cakes, (-(a[va] + b[vb + 1] + c[vc]), va, vb + 1, vc))
        added += [(va, vb + 1, vc)]
    if vc < Z - 1 and (va, vb, vc + 1) not in added:
        heapq.heappush(cakes, (-(a[va] + b[vb] + c[vc + 1]), va, vb, vc + 1))
        added += [(va, vb, vc + 1)]

+import heapq + -ab = [] -for a in A: -    for b in B: -        ab += [a + b] -ab3000 = sorted(ab)[::-1][:3000] -abc = [] -for ab in ab3000: -    for c in C: -        abc += [ab + c] -abc.sort(reverse=True) +a = sorted(A, reverse=True) +b = sorted(B, reverse=True) +c = sorted(C, reverse=True) +added = [(0, 0, 0)] +cakes = [(-(a[0] + b[0] + c[0]), 0, 0, 0)] -    print((abc[k])) +    v = heapq.heappop(cakes) +    print((-v[0])) +    va, vb, vc = v[1:] +    if va < X - 1 and (va + 1, vb, vc) not in added: +        heapq.heappush(cakes, (-(a[va + 1] + b[vb] + c[vc]), va + 1, vb, vc)) +        added += [(va + 1, vb, vc)] +    if vb < Y - 1 and (va, vb + 1, vc) not in added: +        heapq.heappush(cakes, (-(a[va] + b[vb + 1] + c[vc]), va, vb + 1, vc)) +        added += [(va, vb + 1, vc)] +    if vc < Z - 1 and (va, vb, vc + 1) not in added: +        heapq.heappush(cakes, (-(a[va] + b[vb] + c[vc + 1]), va, vb, vc + 1)) +        added += [(va, vb, vc + 1)]