import heapq

 

x, y, z, K = list(map(int, input().split()))

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

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

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

a.sort(reverse = True)

b.sort(reverse = True)

c.sort(reverse = True)

 

n = []

heapq.heapify(n)

heapq.heappush(n, (-(a[0]+b[0] + c[0]), 0,0,0))

for i in range(K):

    (m, j, k, l) = heapq.heappop(n)

    print((-m))

    if j + 1 <=x-1:

        s = (-(a[j+1]+b[k]+c[l]), j+1, k, l)

        if s not in n:

            heapq.heappush(n ,s)

 

    if k + 1 <=y-1:

        s = (-(a[j]+b[k+1]+c[l]), j, k+1, l)

        if s not in n:

            heapq.heappush(n ,s)

    

    if l+ 1 <=z-1:

        s = (-(a[j]+b[k]+c[l+1]), j, k, l+1)

        if s not in n:

            heapq.heappush(n ,s)
import heapq

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

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

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

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

a.sort(reverse = True)

b.sort(reverse = True)

c.sort(reverse = True)

ans = [(-(a[0]+b[0]+c[0]), 0, 0, 0)]

for i in range(K):

    m, j, k, h = heapq.heappop(ans)

    print((-m))

    if j+1 <= X-1:

        s =(-(a[j+1]+b[k]+c[h]), j+1, k, h)

        if s not in ans:

            heapq.heappush(ans, s)

    if k+1 <= Y-1:

        s =(-(a[j]+b[k+1]+c[h]), j , k+1, h)

        if s not in ans:

            heapq.heappush(ans, s)

    if h+1 <= Z-1:

        s =(-(a[j]+b[k]+c[h+1]), j , k, h+1)

        if s not in ans:

            heapq.heappush(ans, s)



import heapq

x, y, z, K = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
n = []
heapq.heapify(n)
heapq.heappush(n, (-(a[0] + b[0] + c[0]), 0, 0, 0))
for i in range(K):
    (m, j, k, l) = heapq.heappop(n)
    print((-m))
    if j + 1 <= x - 1:
        s = (-(a[j + 1] + b[k] + c[l]), j + 1, k, l)
        if s not in n:
            heapq.heappush(n, s)
    if k + 1 <= y - 1:
        s = (-(a[j] + b[k + 1] + c[l]), j, k + 1, l)
        if s not in n:
            heapq.heappush(n, s)
    if l + 1 <= z - 1:
        s = (-(a[j] + b[k] + c[l + 1]), j, k, l + 1)
        if s not in n:
            heapq.heappush(n, s)

import heapq

X, Y, Z, K = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]
for i in range(K):
    m, j, k, h = heapq.heappop(ans)
    print((-m))
    if j + 1 <= X - 1:
        s = (-(a[j + 1] + b[k] + c[h]), j + 1, k, h)
        if s not in ans:
            heapq.heappush(ans, s)
    if k + 1 <= Y - 1:
        s = (-(a[j] + b[k + 1] + c[h]), j, k + 1, h)
        if s not in ans:
            heapq.heappush(ans, s)
    if h + 1 <= Z - 1:
        s = (-(a[j] + b[k] + c[h + 1]), j, k, h + 1)
        if s not in ans:
            heapq.heappush(ans, s)

-x, y, z, K = list(map(int, input().split())) +X, Y, Z, K = list(map(int, input().split())) -n = [] -heapq.heapify(n) -heapq.heappush(n, (-(a[0] + b[0] + c[0]), 0, 0, 0)) +ans = [(-(a[0] + b[0] + c[0]), 0, 0, 0)] -    (m, j, k, l) = heapq.heappop(n) +    m, j, k, h = heapq.heappop(ans) -    if j + 1 <= x - 1: -        s = (-(a[j + 1] + b[k] + c[l]), j + 1, k, l) -        if s not in n: -            heapq.heappush(n, s) -    if k + 1 <= y - 1: -        s = (-(a[j] + b[k + 1] + c[l]), j, k + 1, l) -        if s not in n: -            heapq.heappush(n, s) -    if l + 1 <= z - 1: -        s = (-(a[j] + b[k] + c[l + 1]), j, k, l + 1) -        if s not in n: -            heapq.heappush(n, s) +    if j + 1 <= X - 1: +        s = (-(a[j + 1] + b[k] + c[h]), j + 1, k, h) +        if s not in ans: +            heapq.heappush(ans, s) +    if k + 1 <= Y - 1: +        s = (-(a[j] + b[k + 1] + c[h]), j, k + 1, h) +        if s not in ans: +            heapq.heappush(ans, s) +    if h + 1 <= Z - 1: +        s = (-(a[j] + b[k] + c[h + 1]), j, k, h + 1) +        if s not in ans: +            heapq.heappush(ans, s)