import sys

from itertools import product

def input(): return sys.stdin.readline().rstrip()



def main():

    X, Y, Z, K = list(map(int, input().split()))

    A, B, C = [sorted(map(int, input().split())) for _ in range(3)]



    AB = [a + b for a, b in product(A, B)]

    AB = sorted(AB, reverse=True)[:K]



    ABC = [ab + c for ab, c in product(AB, C)]

    ABC = sorted(ABC, reverse=True)[:K]

    for i in ABC:

        print(i)



if __name__ == '__main__':

    main()

import sys

import heapq

def input(): return sys.stdin.readline().rstrip()



def main():

    X, Y, Z, K = list(map(int, input().split()))

    A, B, C = [sorted(map(int, input().split()), reverse=True) for _ in range(3)]



    hp = []

    heapq.heappush(hp, (- A[0] - B[0] - C[0], 0, 0, 0))

    exists = set([(0, 0, 0)])

    for _ in range(K):

        v, x, y, z = heapq.heappop(hp)

        print((-v))

        if x + 1 < X and (x + 1, y, z) not in exists:

            heapq.heappush(hp, (v + A[x] - A[x+1], x + 1, y, z))

            exists.add((x + 1, y, z))

        if y + 1 < Y and (x, y + 1, z) not in exists:

            heapq.heappush(hp, (v + B[y] - B[y+1], x, y + 1, z))

            exists.add((x, y + 1, z))

        if z + 1 < Z and (x, y, z + 1) not in exists:

            heapq.heappush(hp, (v + C[z] - C[z+1], x, y, z + 1))

            exists.add((x, y, z + 1))



if __name__ == '__main__':

    main()

import sys
from itertools import product


def input():
    return sys.stdin.readline().rstrip()


def main():
    X, Y, Z, K = list(map(int, input().split()))
    A, B, C = [sorted(map(int, input().split())) for _ in range(3)]
    AB = [a + b for a, b in product(A, B)]
    AB = sorted(AB, reverse=True)[:K]
    ABC = [ab + c for ab, c in product(AB, C)]
    ABC = sorted(ABC, reverse=True)[:K]
    for i in ABC:
        print(i)


if __name__ == "__main__":
    main()

import sys
import heapq


def input():
    return sys.stdin.readline().rstrip()


def main():
    X, Y, Z, K = list(map(int, input().split()))
    A, B, C = [sorted(map(int, input().split()), reverse=True) for _ in range(3)]
    hp = []
    heapq.heappush(hp, (-A[0] - B[0] - C[0], 0, 0, 0))
    exists = set([(0, 0, 0)])
    for _ in range(K):
        v, x, y, z = heapq.heappop(hp)
        print((-v))
        if x + 1 < X and (x + 1, y, z) not in exists:
            heapq.heappush(hp, (v + A[x] - A[x + 1], x + 1, y, z))
            exists.add((x + 1, y, z))
        if y + 1 < Y and (x, y + 1, z) not in exists:
            heapq.heappush(hp, (v + B[y] - B[y + 1], x, y + 1, z))
            exists.add((x, y + 1, z))
        if z + 1 < Z and (x, y, z + 1) not in exists:
            heapq.heappush(hp, (v + C[z] - C[z + 1], x, y, z + 1))
            exists.add((x, y, z + 1))


if __name__ == "__main__":
    main()

-from itertools import product +import heapq -    A, B, C = [sorted(map(int, input().split())) for _ in range(3)] -    AB = [a + b for a, b in product(A, B)] -    AB = sorted(AB, reverse=True)[:K] -    ABC = [ab + c for ab, c in product(AB, C)] -    ABC = sorted(ABC, reverse=True)[:K] -    for i in ABC: -        print(i) +    A, B, C = [sorted(map(int, input().split()), reverse=True) for _ in range(3)] +    hp = [] +    heapq.heappush(hp, (-A[0] - B[0] - C[0], 0, 0, 0)) +    exists = set([(0, 0, 0)]) +    for _ in range(K): +        v, x, y, z = heapq.heappop(hp) +        print((-v)) +        if x + 1 < X and (x + 1, y, z) not in exists: +            heapq.heappush(hp, (v + A[x] - A[x + 1], x + 1, y, z)) +            exists.add((x + 1, y, z)) +        if y + 1 < Y and (x, y + 1, z) not in exists: +            heapq.heappush(hp, (v + B[y] - B[y + 1], x, y + 1, z)) +            exists.add((x, y + 1, z)) +        if z + 1 < Z and (x, y, z + 1) not in exists: +            heapq.heappush(hp, (v + C[z] - C[z + 1], x, y, z + 1)) +            exists.add((x, y, z + 1))