import numpy as np

from heapq import *



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

A = [int(x) for x in  input().split()]

B = [int(x) for x in  input().split()]

C = [int(x) for x in  input().split()]



A.sort(reverse=True)

B.sort(reverse=True)

C.sort(reverse=True)



h = []

heappush(h, (-A[0]-B[0]-C[0], 0, 0, 0))

used = set()

result = []



for _ in range(K):

    sum, i, j, k = heappop(h)

    result.append(-sum)

    if i < X-1 and (i+1, j, k) not in used:

        heappush(h, (-A[i+1]-B[j]-C[k], i+1, j, k))

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

    if j < Y-1 and (i, j+1, k) not in used:

        heappush(h, (-A[i]-B[j+1]-C[k], i, j+1, k))

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

    if k < Z-1 and (i, j, k+1) not in used:

        heappush(h, (-A[i]-B[j]-C[k+1], i, j, k+1))

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



for v in result:

    print(v)

from heapq import heappop, heappush



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

A = [int(x) for x in  input().split()]

B = [int(x) for x in  input().split()]

C = [int(x) for x in  input().split()]



A.sort(reverse=True)

B.sort(reverse=True)

C.sort(reverse=True)



h = []

heappush(h, (-A[0]-B[0]-C[0], 0, 0, 0))

used = set()

result = []



for _ in range(K):

    sum, i, j, k = heappop(h)

    result.append(-sum)

    if i < X-1 and (i+1, j, k) not in used:

        heappush(h, (-A[i+1]-B[j]-C[k], i+1, j, k))

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

    if j < Y-1 and (i, j+1, k) not in used:

        heappush(h, (-A[i]-B[j+1]-C[k], i, j+1, k))

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

    if k < Z-1 and (i, j, k+1) not in used:

        heappush(h, (-A[i]-B[j]-C[k+1], i, j, k+1))

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



for v in result:

    print(v)

import numpy as np
from heapq import *

X, Y, Z, K = list(map(int, input().split()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
h = []
heappush(h, (-A[0] - B[0] - C[0], 0, 0, 0))
used = set()
result = []
for _ in range(K):
    sum, i, j, k = heappop(h)
    result.append(-sum)
    if i < X - 1 and (i + 1, j, k) not in used:
        heappush(h, (-A[i + 1] - B[j] - C[k], i + 1, j, k))
        used.add((i + 1, j, k))
    if j < Y - 1 and (i, j + 1, k) not in used:
        heappush(h, (-A[i] - B[j + 1] - C[k], i, j + 1, k))
        used.add((i, j + 1, k))
    if k < Z - 1 and (i, j, k + 1) not in used:
        heappush(h, (-A[i] - B[j] - C[k + 1], i, j, k + 1))
        used.add((i, j, k + 1))
for v in result:
    print(v)

from heapq import heappop, heappush

X, Y, Z, K = list(map(int, input().split()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
h = []
heappush(h, (-A[0] - B[0] - C[0], 0, 0, 0))
used = set()
result = []
for _ in range(K):
    sum, i, j, k = heappop(h)
    result.append(-sum)
    if i < X - 1 and (i + 1, j, k) not in used:
        heappush(h, (-A[i + 1] - B[j] - C[k], i + 1, j, k))
        used.add((i + 1, j, k))
    if j < Y - 1 and (i, j + 1, k) not in used:
        heappush(h, (-A[i] - B[j + 1] - C[k], i, j + 1, k))
        used.add((i, j + 1, k))
    if k < Z - 1 and (i, j, k + 1) not in used:
        heappush(h, (-A[i] - B[j] - C[k + 1], i, j, k + 1))
        used.add((i, j, k + 1))
for v in result:
    print(v)

-import numpy as np -from heapq import * +from heapq import heappop, heappush