*xyz,k = list(map(int, input().split())) 

xyz_list = []

xyz_list.append(list(map(int, input().split())))

xyz_list.append(list(map(int, input().split())))

xyz_list.append(list(map(int, input().split())))

xyz_list[0].sort(reverse=True)

xyz_list[1].sort(reverse=True)

xyz_list[2].sort(reverse=True)



print((xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0]))

p = [1,0,0]

num = lambda x: [

    [x[0]+p[i], x[1]+p[(4-i)%3], x[2]+p[(5-i)%3],

    xyz_list[0][x[0]+p[i]]+xyz_list[1][x[1]+p[(4-i)%3]]+xyz_list[2][x[2]++p[(5-i)%3]]]

    for i in range(3) if x[i]+1 < xyz[i]]

stack = num([0,0,0])

num_dict={}

for i in stack:

    if i[3] not in num_dict:

        num_dict[i[3]] = [[i[0], i[1], i[2]]]

    else:

        num_dict[i[3]].append([i[0], i[1], i[2]])

k -= 1

while k != 0:

    x, y, z, maxi = max(stack, key=lambda x:x[3])

    print(maxi)

    k -= 1

    if k == 0:

      break

    stack.remove([x,y,z,maxi])

    for i in num([x,y,z]):

        if i[3] not in num_dict:

            num_dict[i[3]] = [[i[0], i[1], i[2]]]

            stack.append([i[0], i[1], i[2], i[3]])

        elif [i[0], i[1], i[2]] not in num_dict[i[3]]:

            num_dict[i[3]].append([i[0], i[1], i[2]])

            stack.append([i[0], i[1], i[2], i[3]])

from itertools import product

from heapq import heappop, heappush



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

a = sorted(map(int, input().split()), reverse=True)

b = sorted(map(int, input().split()), reverse=True)

c = sorted(map(int, input().split()), reverse=True)

if x * y * z <= 3000:

    lst = sorted([sum(i) for i in product(a,b,c)], reverse=True)

    [print(i) for i in lst[:k]]

    exit()



idx = [0,0,0]

heap = []

xxx = [x,y,z]



aaa = idx[0] if idx[0]+1 >= x else idx[0] + 1

bbb = idx[1] if idx[1]+1 >= y else idx[1] + 1

ccc = idx[2] if idx[2]+1 >= z else idx[2] + 1

heappush(heap, [-(a[aaa] + b[idx[1]] + c[idx[2]]), [1, 0, 0], 0])

heappush(heap, [-(a[idx[0]] + b[bbb] + c[idx[2]]), [0, 1, 0], 1])

heappush(heap, [-(a[idx[0]] + b[idx[1]] + c[ccc]), [0, 0, 1], 2])

print(a[idx[0]] + b[idx[1]] + c[idx[2]])

doc = {}

for _ in range(min(k-1, x*y*z)):

    score, ix, pos = heappop(heap)

    print(-score)

    for i in range(3):

        tmp = ix.copy()

        tmp[i] = ix[i] if ix[i] + 1 >= xxx[i] else ix[i] + 1

        if ','.join(map(str, tmp)) not in doc:

            doc[','.join(map(str, tmp))] = 1

            score = a[tmp[0]] + b[tmp[1]] + c[tmp[2]]

            # print(idx, ix, score, heap)

            heappush(heap, [-score, tmp, i])



# lst.sort(reverse=True)

# [print(i) for i in lst[:k]]

*xyz, k = list(map(int, input().split()))
xyz_list = []
xyz_list.append(list(map(int, input().split())))
xyz_list.append(list(map(int, input().split())))
xyz_list.append(list(map(int, input().split())))
xyz_list[0].sort(reverse=True)
xyz_list[1].sort(reverse=True)
xyz_list[2].sort(reverse=True)
print((xyz_list[0][0] + xyz_list[1][0] + xyz_list[2][0]))
p = [1, 0, 0]
num = lambda x: [
    [
        x[0] + p[i],
        x[1] + p[(4 - i) % 3],
        x[2] + p[(5 - i) % 3],
        xyz_list[0][x[0] + p[i]]
        + xyz_list[1][x[1] + p[(4 - i) % 3]]
        + xyz_list[2][x[2] + +p[(5 - i) % 3]],
    ]
    for i in range(3)
    if x[i] + 1 < xyz[i]
]
stack = num([0, 0, 0])
num_dict = {}
for i in stack:
    if i[3] not in num_dict:
        num_dict[i[3]] = [[i[0], i[1], i[2]]]
    else:
        num_dict[i[3]].append([i[0], i[1], i[2]])
k -= 1
while k != 0:
    x, y, z, maxi = max(stack, key=lambda x: x[3])
    print(maxi)
    k -= 1
    if k == 0:
        break
    stack.remove([x, y, z, maxi])
    for i in num([x, y, z]):
        if i[3] not in num_dict:
            num_dict[i[3]] = [[i[0], i[1], i[2]]]
            stack.append([i[0], i[1], i[2], i[3]])
        elif [i[0], i[1], i[2]] not in num_dict[i[3]]:
            num_dict[i[3]].append([i[0], i[1], i[2]])
            stack.append([i[0], i[1], i[2], i[3]])

from itertools import product
from heapq import heappop, heappush

x, y, z, k = map(int, input().split())
a = sorted(map(int, input().split()), reverse=True)
b = sorted(map(int, input().split()), reverse=True)
c = sorted(map(int, input().split()), reverse=True)
if x * y * z <= 3000:
    lst = sorted([sum(i) for i in product(a, b, c)], reverse=True)
    [print(i) for i in lst[:k]]
    exit()
idx = [0, 0, 0]
heap = []
xxx = [x, y, z]
aaa = idx[0] if idx[0] + 1 >= x else idx[0] + 1
bbb = idx[1] if idx[1] + 1 >= y else idx[1] + 1
ccc = idx[2] if idx[2] + 1 >= z else idx[2] + 1
heappush(heap, [-(a[aaa] + b[idx[1]] + c[idx[2]]), [1, 0, 0], 0])
heappush(heap, [-(a[idx[0]] + b[bbb] + c[idx[2]]), [0, 1, 0], 1])
heappush(heap, [-(a[idx[0]] + b[idx[1]] + c[ccc]), [0, 0, 1], 2])
print(a[idx[0]] + b[idx[1]] + c[idx[2]])
doc = {}
for _ in range(min(k - 1, x * y * z)):
    score, ix, pos = heappop(heap)
    print(-score)
    for i in range(3):
        tmp = ix.copy()
        tmp[i] = ix[i] if ix[i] + 1 >= xxx[i] else ix[i] + 1
        if ",".join(map(str, tmp)) not in doc:
            doc[",".join(map(str, tmp))] = 1
            score = a[tmp[0]] + b[tmp[1]] + c[tmp[2]]
            # print(idx, ix, score, heap)
            heappush(heap, [-score, tmp, i])
# lst.sort(reverse=True)
# [print(i) for i in lst[:k]]

-*xyz, k = list(map(int, input().split())) -xyz_list = [] -xyz_list.append(list(map(int, input().split()))) -xyz_list.append(list(map(int, input().split()))) -xyz_list.append(list(map(int, input().split()))) -xyz_list[0].sort(reverse=True) -xyz_list[1].sort(reverse=True) -xyz_list[2].sort(reverse=True) -print((xyz_list[0][0] + xyz_list[1][0] + xyz_list[2][0])) -p = [1, 0, 0] -num = lambda x: [ -    [ -        x[0] + p[i], -        x[1] + p[(4 - i) % 3], -        x[2] + p[(5 - i) % 3], -        xyz_list[0][x[0] + p[i]] -        + xyz_list[1][x[1] + p[(4 - i) % 3]] -        + xyz_list[2][x[2] + +p[(5 - i) % 3]], -    ] -    for i in range(3) -    if x[i] + 1 < xyz[i] -] -stack = num([0, 0, 0]) -num_dict = {} -for i in stack: -    if i[3] not in num_dict: -        num_dict[i[3]] = [[i[0], i[1], i[2]]] -    else: -        num_dict[i[3]].append([i[0], i[1], i[2]]) -k -= 1 -while k != 0: -    x, y, z, maxi = max(stack, key=lambda x: x[3]) -    print(maxi) -    k -= 1 -    if k == 0: -        break -    stack.remove([x, y, z, maxi]) -    for i in num([x, y, z]): -        if i[3] not in num_dict: -            num_dict[i[3]] = [[i[0], i[1], i[2]]] -            stack.append([i[0], i[1], i[2], i[3]]) -        elif [i[0], i[1], i[2]] not in num_dict[i[3]]: -            num_dict[i[3]].append([i[0], i[1], i[2]]) -            stack.append([i[0], i[1], i[2], i[3]]) +from itertools import product +from heapq import heappop, heappush + +x, y, z, k = map(int, input().split()) +a = sorted(map(int, input().split()), reverse=True) +b = sorted(map(int, input().split()), reverse=True) +c = sorted(map(int, input().split()), reverse=True) +if x * y * z <= 3000: +    lst = sorted([sum(i) for i in product(a, b, c)], reverse=True) +    [print(i) for i in lst[:k]] +    exit() +idx = [0, 0, 0] +heap = [] +xxx = [x, y, z] +aaa = idx[0] if idx[0] + 1 >= x else idx[0] + 1 +bbb = idx[1] if idx[1] + 1 >= y else idx[1] + 1 +ccc = idx[2] if idx[2] + 1 >= z else idx[2] + 1 +heappush(heap, [-(a[aaa] + b[idx[1]] + c[idx[2]]), [1, 0, 0], 0]) +heappush(heap, [-(a[idx[0]] + b[bbb] + c[idx[2]]), [0, 1, 0], 1]) +heappush(heap, [-(a[idx[0]] + b[idx[1]] + c[ccc]), [0, 0, 1], 2]) +print(a[idx[0]] + b[idx[1]] + c[idx[2]]) +doc = {} +for _ in range(min(k - 1, x * y * z)): +    score, ix, pos = heappop(heap) +    print(-score) +    for i in range(3): +        tmp = ix.copy() +        tmp[i] = ix[i] if ix[i] + 1 >= xxx[i] else ix[i] + 1 +        if ",".join(map(str, tmp)) not in doc: +            doc[",".join(map(str, tmp))] = 1 +            score = a[tmp[0]] + b[tmp[1]] + c[tmp[2]] +            # print(idx, ix, score, heap) +            heappush(heap, [-score, tmp, i]) +# lst.sort(reverse=True) +# [print(i) for i in lst[:k]]