a, b, c, d = list(map(int, input().split()))

al = list(map(int, input().split()))

bl = list(map(int, input().split()))

cl = list(map(int, input().split()))

al = sorted(al, reverse=True)

bl = sorted(bl, reverse=True)

cl = sorted(cl, reverse=True)

q = [[al[0] + bl[0] + cl[0], 0, 0, 0]]

ans = [[al[0] + bl[0] + cl[0], 0, 0, 0]]

c = -1

#while True:

    #c += 1

for i in range(d):

    #print(c)

    #print(len(ans))

    s, aq, bq, cq = list(map(int, q.pop()))

    if len(al) > aq+1:

        if [al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq] not in ans:

            q.append([al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq])

            ans.append([al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq])



    if len(bl) > bq+1:

        if [al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq] not in ans:

            q.append([al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq])

            ans.append([al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq])



    if len(cl) > cq+1:

        if [al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1] not in ans:

            q.append([al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1])

            ans.append([al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1])



    q = sorted(q)



    #if len(ans) > d:

    #    ans = sorted(ans, reverse=True)

    #    if ans[d-1][0] > q[len(q)-1][0]:

    #       break



ans = sorted(ans, reverse=True)

for i in range(d):

    print((ans[i][0]))

import heapq



a, b, c, d = list(map(int, input().split()))

A = list(map(int, input().split()))

A = sorted(A, reverse=True)

B = list(map(int, input().split()))

B = sorted(B, reverse=True)

C = list(map(int, input().split()))

C = sorted(C, reverse=True)

ans = []

q_list = []

n_q = []

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

for i in range(d):

    x, y, z, v = list(map(int, heapq.heappop(n_q)))

    ans.append(-x)



    if y + 1 < a and [y + 1, z, v] not in q_list:

        heapq.heappush(n_q, [-(A[y + 1] + B[z] + C[v]), y + 1, z, v])

        q_list.append([y + 1, z, v])

    if z + 1 < b and [y, z + 1, v] not in q_list:

        heapq.heappush(n_q, [-(A[y] + B[z + 1] + C[v]), y, z + 1, v])

        q_list.append([y, z + 1, v])

    if v + 1 < c and [y, z, v + 1] not in q_list:

        heapq.heappush(n_q, [-(A[y] + B[z] + C[v + 1]), y, z, v + 1])

        q_list.append([y, z, v + 1])



for i in range(d):

    print((ans[i]))

a, b, c, d = list(map(int, input().split()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al = sorted(al, reverse=True)
bl = sorted(bl, reverse=True)
cl = sorted(cl, reverse=True)
q = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
ans = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
c = -1
# while True:
# c += 1
for i in range(d):
    # print(c)
    # print(len(ans))
    s, aq, bq, cq = list(map(int, q.pop()))
    if len(al) > aq + 1:
        if [al[aq + 1] + bl[bq] + cl[cq], aq + 1, bq, cq] not in ans:
            q.append([al[aq + 1] + bl[bq] + cl[cq], aq + 1, bq, cq])
            ans.append([al[aq + 1] + bl[bq] + cl[cq], aq + 1, bq, cq])
    if len(bl) > bq + 1:
        if [al[aq] + bl[bq + 1] + cl[cq], aq, bq + 1, cq] not in ans:
            q.append([al[aq] + bl[bq + 1] + cl[cq], aq, bq + 1, cq])
            ans.append([al[aq] + bl[bq + 1] + cl[cq], aq, bq + 1, cq])
    if len(cl) > cq + 1:
        if [al[aq] + bl[bq] + cl[cq + 1], aq, bq, cq + 1] not in ans:
            q.append([al[aq] + bl[bq] + cl[cq + 1], aq, bq, cq + 1])
            ans.append([al[aq] + bl[bq] + cl[cq + 1], aq, bq, cq + 1])
    q = sorted(q)
    # if len(ans) > d:
    #    ans = sorted(ans, reverse=True)
    #    if ans[d-1][0] > q[len(q)-1][0]:
    #       break
ans = sorted(ans, reverse=True)
for i in range(d):
    print((ans[i][0]))

import heapq

a, b, c, d = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
B = list(map(int, input().split()))
B = sorted(B, reverse=True)
C = list(map(int, input().split()))
C = sorted(C, reverse=True)
ans = []
q_list = []
n_q = []
heapq.heappush(n_q, [-(A[0] + B[0] + C[0]), 0, 0, 0])
for i in range(d):
    x, y, z, v = list(map(int, heapq.heappop(n_q)))
    ans.append(-x)
    if y + 1 < a and [y + 1, z, v] not in q_list:
        heapq.heappush(n_q, [-(A[y + 1] + B[z] + C[v]), y + 1, z, v])
        q_list.append([y + 1, z, v])
    if z + 1 < b and [y, z + 1, v] not in q_list:
        heapq.heappush(n_q, [-(A[y] + B[z + 1] + C[v]), y, z + 1, v])
        q_list.append([y, z + 1, v])
    if v + 1 < c and [y, z, v + 1] not in q_list:
        heapq.heappush(n_q, [-(A[y] + B[z] + C[v + 1]), y, z, v + 1])
        q_list.append([y, z, v + 1])
for i in range(d):
    print((ans[i]))

+import heapq + -al = list(map(int, input().split())) -bl = list(map(int, input().split())) -cl = list(map(int, input().split())) -al = sorted(al, reverse=True) -bl = sorted(bl, reverse=True) -cl = sorted(cl, reverse=True) -q = [[al[0] + bl[0] + cl[0], 0, 0, 0]] -ans = [[al[0] + bl[0] + cl[0], 0, 0, 0]] -c = -1 -# while True: -# c += 1 +A = list(map(int, input().split())) +A = sorted(A, reverse=True) +B = list(map(int, input().split())) +B = sorted(B, reverse=True) +C = list(map(int, input().split())) +C = sorted(C, reverse=True) +ans = [] +q_list = [] +n_q = [] +heapq.heappush(n_q, [-(A[0] + B[0] + C[0]), 0, 0, 0]) -    # print(c) -    # print(len(ans)) -    s, aq, bq, cq = list(map(int, q.pop())) -    if len(al) > aq + 1: -        if [al[aq + 1] + bl[bq] + cl[cq], aq + 1, bq, cq] not in ans: -            q.append([al[aq + 1] + bl[bq] + cl[cq], aq + 1, bq, cq]) -            ans.append([al[aq + 1] + bl[bq] + cl[cq], aq + 1, bq, cq]) -    if len(bl) > bq + 1: -        if [al[aq] + bl[bq + 1] + cl[cq], aq, bq + 1, cq] not in ans: -            q.append([al[aq] + bl[bq + 1] + cl[cq], aq, bq + 1, cq]) -            ans.append([al[aq] + bl[bq + 1] + cl[cq], aq, bq + 1, cq]) -    if len(cl) > cq + 1: -        if [al[aq] + bl[bq] + cl[cq + 1], aq, bq, cq + 1] not in ans: -            q.append([al[aq] + bl[bq] + cl[cq + 1], aq, bq, cq + 1]) -            ans.append([al[aq] + bl[bq] + cl[cq + 1], aq, bq, cq + 1]) -    q = sorted(q) -    # if len(ans) > d: -    #    ans = sorted(ans, reverse=True) -    #    if ans[d-1][0] > q[len(q)-1][0]: -    #       break -ans = sorted(ans, reverse=True) +    x, y, z, v = list(map(int, heapq.heappop(n_q))) +    ans.append(-x) +    if y + 1 < a and [y + 1, z, v] not in q_list: +        heapq.heappush(n_q, [-(A[y + 1] + B[z] + C[v]), y + 1, z, v]) +        q_list.append([y + 1, z, v]) +    if z + 1 < b and [y, z + 1, v] not in q_list: +        heapq.heappush(n_q, [-(A[y] + B[z + 1] + C[v]), y, z + 1, v]) +        q_list.append([y, z + 1, v]) +    if v + 1 < c and [y, z, v + 1] not in q_list: +        heapq.heappush(n_q, [-(A[y] + B[z] + C[v + 1]), y, z, v + 1]) +        q_list.append([y, z, v + 1]) -    print((ans[i][0])) +    print((ans[i]))