from collections import defaultdict

inpl = lambda: list(map(int,input().split()))



X, Y, Z, K = inpl()

A = [ sorted(inpl(), key=lambda x: -x) for _ in range(3) ]

N = [X, Y, Z]



mem = defaultdict(int)

ans = sum([A[i][0] for i in range(3)])

mem[(0,0,0)] = 1

cand = [(ans,0,0,0)]



for i in range(K):

    cand.sort()

    c = cand[-1]

    print((c[0]))

    n = [c[1],c[2],c[3]]

    cand.pop(-1)

    

    for p in range(3):

        if n[p] < N[p]-1:

            n[p] += 1

            if mem[(n[0],n[1],n[2])] == 0:

                mem[(n[0],n[1],n[2])] = 1

                cand.append((sum([A[j][n[j]] for j in range(3)]),n[0],n[1],n[2]))

            n[p] -= 1
from collections import defaultdict

import heapq

inpl = lambda: list(map(int,input().split()))



X, Y, Z, K = inpl()

A = [ sorted(inpl(), reverse=True) for _ in range(3) ]

N = [X, Y, Z]



mem = defaultdict(int)

score = sum([A[i][0] for i in range(3)])

mem[(0,0,0)] = 1

candidates = []

heapq.heappush(candidates, (-score,(0,0,0)))



for i in range(K):

    c = heapq.heappop(candidates)

    print((-c[0]))

    n = list(c[1])

    

    for p in range(3):

        if n[p] < N[p]-1:

            n[p] += 1

            if mem[tuple(n)] == 0:

                mem[tuple(n)] = 1

                score = sum([A[j][n[j]] for j in range(3)])

                heapq.heappush(candidates, (-score,tuple(n)))

            n[p] -= 1
from collections import defaultdict

inpl = lambda: list(map(int, input().split()))
X, Y, Z, K = inpl()
A = [sorted(inpl(), key=lambda x: -x) for _ in range(3)]
N = [X, Y, Z]
mem = defaultdict(int)
ans = sum([A[i][0] for i in range(3)])
mem[(0, 0, 0)] = 1
cand = [(ans, 0, 0, 0)]
for i in range(K):
    cand.sort()
    c = cand[-1]
    print((c[0]))
    n = [c[1], c[2], c[3]]
    cand.pop(-1)
    for p in range(3):
        if n[p] < N[p] - 1:
            n[p] += 1
            if mem[(n[0], n[1], n[2])] == 0:
                mem[(n[0], n[1], n[2])] = 1
                cand.append((sum([A[j][n[j]] for j in range(3)]), n[0], n[1], n[2]))
            n[p] -= 1

from collections import defaultdict
import heapq

inpl = lambda: list(map(int, input().split()))
X, Y, Z, K = inpl()
A = [sorted(inpl(), reverse=True) for _ in range(3)]
N = [X, Y, Z]
mem = defaultdict(int)
score = sum([A[i][0] for i in range(3)])
mem[(0, 0, 0)] = 1
candidates = []
heapq.heappush(candidates, (-score, (0, 0, 0)))
for i in range(K):
    c = heapq.heappop(candidates)
    print((-c[0]))
    n = list(c[1])
    for p in range(3):
        if n[p] < N[p] - 1:
            n[p] += 1
            if mem[tuple(n)] == 0:
                mem[tuple(n)] = 1
                score = sum([A[j][n[j]] for j in range(3)])
                heapq.heappush(candidates, (-score, tuple(n)))
            n[p] -= 1

+import heapq -A = [sorted(inpl(), key=lambda x: -x) for _ in range(3)] +A = [sorted(inpl(), reverse=True) for _ in range(3)] -ans = sum([A[i][0] for i in range(3)]) +score = sum([A[i][0] for i in range(3)]) -cand = [(ans, 0, 0, 0)] +candidates = [] +heapq.heappush(candidates, (-score, (0, 0, 0))) -    cand.sort() -    c = cand[-1] -    print((c[0])) -    n = [c[1], c[2], c[3]] -    cand.pop(-1) +    c = heapq.heappop(candidates) +    print((-c[0])) +    n = list(c[1]) -            if mem[(n[0], n[1], n[2])] == 0: -                mem[(n[0], n[1], n[2])] = 1 -                cand.append((sum([A[j][n[j]] for j in range(3)]), n[0], n[1], n[2])) +            if mem[tuple(n)] == 0: +                mem[tuple(n)] = 1 +                score = sum([A[j][n[j]] for j in range(3)]) +                heapq.heappush(candidates, (-score, tuple(n)))