import numpy as np

import itertools



X, Y, Z, K = tuple([int(x) for x in str(eval(input())).split(' ')])



A = np.array(sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True))

B = np.array(sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True))

C = np.array(sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True))



tmp = {(0, 0, 0) : A[0] + B[0] + C[0]}

tmp_keys = [(0, 0 ,0)]

out = []



for i in range(K):

    (a, b, c),  p = max(list(tmp.items()), key=lambda x : x[1])

    out.append(tmp.pop((a, b, c)))



    keys = []

    if a < X - 1:

        keys.append((a+1, b, c))

    if b < Y - 1:

        keys.append((a, b+1, c))

    if c < Z - 1:

        keys.append((a, b, c+1))

    

    for key in keys:

        if key not in tmp_keys:

            tmp[key] = A[key[0]] + B[key[1]] + C[key[2]]

            tmp_keys.append(key)



for x in out:

    print(x)
import itertools



X, Y, Z, K = tuple([int(x) for x in str(eval(input())).split(' ')])



A = sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True)

B = sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True)

C = sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True)



tmp = {(0, 0, 0) : A[0] + B[0] + C[0]}

tmp_keys = [(0, 0 ,0)]

out = []



for i in range(K):

    (a, b, c),  p = max(list(tmp.items()), key=lambda x : x[1])

    out.append(tmp.pop((a, b, c)))



    keys = []

    if a < X - 1:

        keys.append((a+1, b, c))

    if b < Y - 1:

        keys.append((a, b+1, c))

    if c < Z - 1:

        keys.append((a, b, c+1))

    

    for key in keys:

        if key not in tmp_keys:

            tmp[key] = A[key[0]] + B[key[1]] + C[key[2]]

            tmp_keys.append(key)



for x in out:

    print(x)
import numpy as np
import itertools

X, Y, Z, K = tuple([int(x) for x in str(eval(input())).split(" ")])
A = np.array(sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True))
B = np.array(sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True))
C = np.array(sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True))
tmp = {(0, 0, 0): A[0] + B[0] + C[0]}
tmp_keys = [(0, 0, 0)]
out = []
for i in range(K):
    (a, b, c), p = max(list(tmp.items()), key=lambda x: x[1])
    out.append(tmp.pop((a, b, c)))
    keys = []
    if a < X - 1:
        keys.append((a + 1, b, c))
    if b < Y - 1:
        keys.append((a, b + 1, c))
    if c < Z - 1:
        keys.append((a, b, c + 1))
    for key in keys:
        if key not in tmp_keys:
            tmp[key] = A[key[0]] + B[key[1]] + C[key[2]]
            tmp_keys.append(key)
for x in out:
    print(x)

import itertools

X, Y, Z, K = tuple([int(x) for x in str(eval(input())).split(" ")])
A = sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True)
B = sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True)
C = sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True)
tmp = {(0, 0, 0): A[0] + B[0] + C[0]}
tmp_keys = [(0, 0, 0)]
out = []
for i in range(K):
    (a, b, c), p = max(list(tmp.items()), key=lambda x: x[1])
    out.append(tmp.pop((a, b, c)))
    keys = []
    if a < X - 1:
        keys.append((a + 1, b, c))
    if b < Y - 1:
        keys.append((a, b + 1, c))
    if c < Z - 1:
        keys.append((a, b, c + 1))
    for key in keys:
        if key not in tmp_keys:
            tmp[key] = A[key[0]] + B[key[1]] + C[key[2]]
            tmp_keys.append(key)
for x in out:
    print(x)

-import numpy as np -A = np.array(sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True)) -B = np.array(sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True)) -C = np.array(sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True)) +A = sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True) +B = sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True) +C = sorted([int(x) for x in str(eval(input())).split(" ")], reverse=True)