from heapq import *



an, bn, cn, k = 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)

la = len(a)

lb = len(b)

lc = len(c)



ans = []

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

heapify(hp)

sumi = [[0, 0, 0]]

for _ in range(k):

    hpk = heappop(hp)

    mx = hpk[0]

    ai = hpk[1]

    bi = hpk[2]

    ci = hpk[3]

    if ai + 1 < la and [ai + 1, bi, ci] not in sumi:

        heappush(hp, [mx + a[ai] - a[ai + 1], ai + 1, bi, ci])

        sumi += [[ai + 1, bi, ci]]

    if bi + 1 < lb and [ai, bi + 1, ci] not in sumi:

        heappush(hp, [mx + b[bi] - b[bi + 1], ai, bi + 1, ci])

        sumi += [[ai, bi + 1, ci]]

    if ci + 1 < lc and [ai, bi, ci + 1] not in sumi:

        heappush(hp, [mx + c[ci] - c[ci + 1], ai, bi, ci + 1])

        sumi += [[ai, bi, ci + 1]]

    ans += [-mx]



print(*ans, sep="\n")

from heapq import *



an, bn, cn, k = 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)

la = len(a)

lb = len(b)

lc = len(c)



ans = []

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

heapify(hp)

sumi = {(0, 0, 0)}

for _ in range(k):

    hpk = heappop(hp)

    mx = hpk[0]

    ai = hpk[1]

    bi = hpk[2]

    ci = hpk[3]

    if ai + 1 < la and (ai + 1, bi, ci) not in sumi:

        heappush(hp, [mx + a[ai] - a[ai + 1], ai + 1, bi, ci])

        sumi.add((ai + 1, bi, ci))

    if bi + 1 < lb and (ai, bi + 1, ci) not in sumi:

        heappush(hp, [mx + b[bi] - b[bi + 1], ai, bi + 1, ci])

        sumi.add((ai, bi + 1, ci))

    if ci + 1 < lc and (ai, bi, ci + 1) not in sumi:

        heappush(hp, [mx + c[ci] - c[ci + 1], ai, bi, ci + 1])

        sumi.add((ai, bi, ci + 1))

    ans += [-mx]



print(*ans, sep="\n")

from heapq import *

an, bn, cn, k = 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)
la = len(a)
lb = len(b)
lc = len(c)
ans = []
hp = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]
heapify(hp)
sumi = [[0, 0, 0]]
for _ in range(k):
    hpk = heappop(hp)
    mx = hpk[0]
    ai = hpk[1]
    bi = hpk[2]
    ci = hpk[3]
    if ai + 1 < la and [ai + 1, bi, ci] not in sumi:
        heappush(hp, [mx + a[ai] - a[ai + 1], ai + 1, bi, ci])
        sumi += [[ai + 1, bi, ci]]
    if bi + 1 < lb and [ai, bi + 1, ci] not in sumi:
        heappush(hp, [mx + b[bi] - b[bi + 1], ai, bi + 1, ci])
        sumi += [[ai, bi + 1, ci]]
    if ci + 1 < lc and [ai, bi, ci + 1] not in sumi:
        heappush(hp, [mx + c[ci] - c[ci + 1], ai, bi, ci + 1])
        sumi += [[ai, bi, ci + 1]]
    ans += [-mx]
print(*ans, sep="\n")

from heapq import *

an, bn, cn, k = 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)
la = len(a)
lb = len(b)
lc = len(c)
ans = []
hp = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]
heapify(hp)
sumi = {(0, 0, 0)}
for _ in range(k):
    hpk = heappop(hp)
    mx = hpk[0]
    ai = hpk[1]
    bi = hpk[2]
    ci = hpk[3]
    if ai + 1 < la and (ai + 1, bi, ci) not in sumi:
        heappush(hp, [mx + a[ai] - a[ai + 1], ai + 1, bi, ci])
        sumi.add((ai + 1, bi, ci))
    if bi + 1 < lb and (ai, bi + 1, ci) not in sumi:
        heappush(hp, [mx + b[bi] - b[bi + 1], ai, bi + 1, ci])
        sumi.add((ai, bi + 1, ci))
    if ci + 1 < lc and (ai, bi, ci + 1) not in sumi:
        heappush(hp, [mx + c[ci] - c[ci + 1], ai, bi, ci + 1])
        sumi.add((ai, bi, ci + 1))
    ans += [-mx]
print(*ans, sep="\n")

-sumi = [[0, 0, 0]] +sumi = {(0, 0, 0)} -    if ai + 1 < la and [ai + 1, bi, ci] not in sumi: +    if ai + 1 < la and (ai + 1, bi, ci) not in sumi: -        sumi += [[ai + 1, bi, ci]] -    if bi + 1 < lb and [ai, bi + 1, ci] not in sumi: +        sumi.add((ai + 1, bi, ci)) +    if bi + 1 < lb and (ai, bi + 1, ci) not in sumi: -        sumi += [[ai, bi + 1, ci]] -    if ci + 1 < lc and [ai, bi, ci + 1] not in sumi: +        sumi.add((ai, bi + 1, ci)) +    if ci + 1 < lc and (ai, bi, ci + 1) not in sumi: -        sumi += [[ai, bi, ci + 1]] +        sumi.add((ai, bi, ci + 1))