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

a,b,c=[sorted(list(map(int,input().split())),reverse=True) for i in range(3)]

L=[]

for i in range(x):

    for j in range(y):

        if (i+1)*(j+1)>k:

            break

        for m in range(z):

            if (i+1)*(j+1)*(m+1)>k:

                break

            else:

                L.append(a[i]+b[j]+c[m])

for i in sorted(L,reverse=True)[:k]:

    print(i)
import heapq

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

a,b,c=[sorted(list(map(int,input().split())),reverse=True) for i in range(3)]

heap=[(-a[0]-b[0]-c[0],0,0,0)]

ed=set()

for _ in range(t):

	p,i,j,k=heapq.heappop(heap)

	print((-p))

	if i+1<x and (i+1,j,k) not in ed:

		ed.add((i+1,j,k))

		heapq.heappush(heap,(-a[i+1]-b[j]-c[k],i+1,j,k))

	if j+1<y and (i,j+1,k) not in ed:

		ed.add((i,j+1,k))

		heapq.heappush(heap,(-a[i]-b[j+1]-c[k],i,j+1,k))

	if k+1<z and (i,j,k+1) not in ed:

		ed.add((i,j,k+1))

		heapq.heappush(heap,(-a[i]-b[j]-c[k+1],i,j,k+1))

	
x, y, z, k = list(map(int, input().split()))
a, b, c = [sorted(list(map(int, input().split())), reverse=True) for i in range(3)]
L = []
for i in range(x):
    for j in range(y):
        if (i + 1) * (j + 1) > k:
            break
        for m in range(z):
            if (i + 1) * (j + 1) * (m + 1) > k:
                break
            else:
                L.append(a[i] + b[j] + c[m])
for i in sorted(L, reverse=True)[:k]:
    print(i)

import heapq

x, y, z, t = list(map(int, input().split()))
a, b, c = [sorted(list(map(int, input().split())), reverse=True) for i in range(3)]
heap = [(-a[0] - b[0] - c[0], 0, 0, 0)]
ed = set()
for _ in range(t):
    p, i, j, k = heapq.heappop(heap)
    print((-p))
    if i + 1 < x and (i + 1, j, k) not in ed:
        ed.add((i + 1, j, k))
        heapq.heappush(heap, (-a[i + 1] - b[j] - c[k], i + 1, j, k))
    if j + 1 < y and (i, j + 1, k) not in ed:
        ed.add((i, j + 1, k))
        heapq.heappush(heap, (-a[i] - b[j + 1] - c[k], i, j + 1, k))
    if k + 1 < z and (i, j, k + 1) not in ed:
        ed.add((i, j, k + 1))
        heapq.heappush(heap, (-a[i] - b[j] - c[k + 1], i, j, k + 1))

-x, y, z, k = list(map(int, input().split())) +import heapq + +x, y, z, t = list(map(int, input().split())) -L = [] -for i in range(x): -    for j in range(y): -        if (i + 1) * (j + 1) > k: -            break -        for m in range(z): -            if (i + 1) * (j + 1) * (m + 1) > k: -                break -            else: -                L.append(a[i] + b[j] + c[m]) -for i in sorted(L, reverse=True)[:k]: -    print(i) +heap = [(-a[0] - b[0] - c[0], 0, 0, 0)] +ed = set() +for _ in range(t): +    p, i, j, k = heapq.heappop(heap) +    print((-p)) +    if i + 1 < x and (i + 1, j, k) not in ed: +        ed.add((i + 1, j, k)) +        heapq.heappush(heap, (-a[i + 1] - b[j] - c[k], i + 1, j, k)) +    if j + 1 < y and (i, j + 1, k) not in ed: +        ed.add((i, j + 1, k)) +        heapq.heappush(heap, (-a[i] - b[j + 1] - c[k], i, j + 1, k)) +    if k + 1 < z and (i, j, k + 1) not in ed: +        ed.add((i, j, k + 1)) +        heapq.heappush(heap, (-a[i] - b[j] - c[k + 1], i, j, k + 1))