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]]

#while True:

for i in range(d):

    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][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()))

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 = []

heapq.heappush(q, [-(al[0] + bl[0] + cl[0]), 0, 0, 0])

ans = []

heapq.heappush(ans, [-(al[0] + bl[0] + cl[0]), 0, 0, 0])



#while True:

for i in range(d):

    s, aq, bq, cq = heapq.heappop(q)

    if len(al) > aq+1:

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

            heapq.heappush(q, [-(al[aq+1] + bl[bq] + cl[cq]), aq+1, bq, cq])

            heapq.heappush(ans, [-(al[aq+1] + bl[bq] + cl[cq]), aq+1, bq, cq])

            #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:

            heapq.heappush(q, [-(al[aq] + bl[bq+1] + cl[cq]), aq, bq+1, cq])

            heapq.heappush(ans, [-(al[aq] + bl[bq+1] + cl[cq]), aq, bq+1, cq])

            #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:

            heapq.heappush(q, [-(al[aq] + bl[bq] + cl[cq+1]), aq, bq, cq+1])

            heapq.heappush(ans, [-(al[aq] + bl[bq] + cl[cq+1]), aq, bq, cq+1])

            #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][0] > q[len(q)-1][0]:

    #        break



for i in range(d):

    print((-heapq.heappop(ans)[0]))

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]]
# while True:
for i in range(d):
    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][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()))
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 = []
heapq.heappush(q, [-(al[0] + bl[0] + cl[0]), 0, 0, 0])
ans = []
heapq.heappush(ans, [-(al[0] + bl[0] + cl[0]), 0, 0, 0])
# while True:
for i in range(d):
    s, aq, bq, cq = heapq.heappop(q)
    if len(al) > aq + 1:
        if [-(al[aq + 1] + bl[bq] + cl[cq]), aq + 1, bq, cq] not in ans:
            heapq.heappush(q, [-(al[aq + 1] + bl[bq] + cl[cq]), aq + 1, bq, cq])
            heapq.heappush(ans, [-(al[aq + 1] + bl[bq] + cl[cq]), aq + 1, bq, cq])
            # 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:
            heapq.heappush(q, [-(al[aq] + bl[bq + 1] + cl[cq]), aq, bq + 1, cq])
            heapq.heappush(ans, [-(al[aq] + bl[bq + 1] + cl[cq]), aq, bq + 1, cq])
            # 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:
            heapq.heappush(q, [-(al[aq] + bl[bq] + cl[cq + 1]), aq, bq, cq + 1])
            heapq.heappush(ans, [-(al[aq] + bl[bq] + cl[cq + 1]), aq, bq, cq + 1])
            # 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][0] > q[len(q)-1][0]:
    #        break
for i in range(d):
    print((-heapq.heappop(ans)[0]))

+import heapq + -q = [[al[0] + bl[0] + cl[0], 0, 0, 0]] -ans = [[al[0] + bl[0] + cl[0], 0, 0, 0]] +q = [] +heapq.heappush(q, [-(al[0] + bl[0] + cl[0]), 0, 0, 0]) +ans = [] +heapq.heappush(ans, [-(al[0] + bl[0] + cl[0]), 0, 0, 0]) -    s, aq, bq, cq = list(map(int, q.pop())) +    s, aq, bq, cq = heapq.heappop(q) -        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 [-(al[aq + 1] + bl[bq] + cl[cq]), aq + 1, bq, cq] not in ans: +            heapq.heappush(q, [-(al[aq + 1] + bl[bq] + cl[cq]), aq + 1, bq, cq]) +            heapq.heappush(ans, [-(al[aq + 1] + bl[bq] + cl[cq]), aq + 1, bq, cq]) +            # 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 [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 [-(al[aq] + bl[bq + 1] + cl[cq]), aq, bq + 1, cq] not in ans: +            heapq.heappush(q, [-(al[aq] + bl[bq + 1] + cl[cq]), aq, bq + 1, cq]) +            heapq.heappush(ans, [-(al[aq] + bl[bq + 1] + cl[cq]), aq, bq + 1, cq]) +            # 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 [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 [-(al[aq] + bl[bq] + cl[cq + 1]), aq, bq, cq + 1] not in ans: +            heapq.heappush(q, [-(al[aq] + bl[bq] + cl[cq + 1]), aq, bq, cq + 1]) +            heapq.heappush(ans, [-(al[aq] + bl[bq] + cl[cq + 1]), aq, bq, cq + 1]) +            # 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) -ans = sorted(ans, reverse=True) -    print((ans[i][0])) +    print((-heapq.heappop(ans)[0]))