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



def diff(l):

    m = max(l)

    return sorted(m - v for v in l)[1:]



s = sum(map(max, [a, b, c]))

sa, sb, sc = list(map(diff, [a, b, c]))

da, db, dc = [0], [0], [0]

q = [0]

while k > 0:

    while True:

        if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):

            for v in [sa[0] + bb + cc for bb in db for cc in dc]:

                heapq.heappush(q, v)

            da.append(sa[0])

            sa = sa[1:]

        elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):

            for v in [sb[0] + aa + cc for aa in da for cc in dc]:

                heapq.heappush(q, v)

            db.append(sb[0])

            sb = sb[1:]

        elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):

            for v in [sc[0] + aa + bb for aa in da for bb in db]:

                heapq.heappush(q, v)

            dc.append(sc[0])

            sc = sc[1:]

        else:

            break

    v = heapq.heappop(q)

    print(s - v)

    k -= 1

import heapq



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

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

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

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



q = []

memo = set()

def qpush(q, ai, bi, ci):

    t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)

    if not t in memo:

        memo.add(t)

        heapq.heappush(q, t)



qpush(q, len(a) - 1, len(b) - 1, len(c) - 1)

for _ in range(k):

    s, ai, bi, ci = heapq.heappop(q)

    if ai > 0:

        qpush(q, ai - 1, bi, ci)

    if bi > 0:

        qpush(q, ai, bi - 1, ci)

    if ci > 0:

        qpush(q, ai, bi, ci - 1)

    print(-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()))


def diff(l):
    m = max(l)
    return sorted(m - v for v in l)[1:]


s = sum(map(max, [a, b, c]))
sa, sb, sc = list(map(diff, [a, b, c]))
da, db, dc = [0], [0], [0]
q = [0]
while k > 0:
    while True:
        if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):
            for v in [sa[0] + bb + cc for bb in db for cc in dc]:
                heapq.heappush(q, v)
            da.append(sa[0])
            sa = sa[1:]
        elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):
            for v in [sb[0] + aa + cc for aa in da for cc in dc]:
                heapq.heappush(q, v)
            db.append(sb[0])
            sb = sb[1:]
        elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):
            for v in [sc[0] + aa + bb for aa in da for bb in db]:
                heapq.heappush(q, v)
            dc.append(sc[0])
            sc = sc[1:]
        else:
            break
    v = heapq.heappop(q)
    print(s - v)
    k -= 1

import heapq

x, y, z, k = list(map(int, input().split()))
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))
q = []
memo = set()


def qpush(q, ai, bi, ci):
    t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)
    if not t in memo:
        memo.add(t)
        heapq.heappush(q, t)


qpush(q, len(a) - 1, len(b) - 1, len(c) - 1)
for _ in range(k):
    s, ai, bi, ci = heapq.heappop(q)
    if ai > 0:
        qpush(q, ai - 1, bi, ci)
    if bi > 0:
        qpush(q, ai, bi - 1, ci)
    if ci > 0:
        qpush(q, ai, bi, ci - 1)
    print(-s)

-a = list(map(int, input().split())) -b = list(map(int, input().split())) -c = list(map(int, input().split())) +a = sorted(map(int, input().split())) +b = sorted(map(int, input().split())) +c = sorted(map(int, input().split())) +q = [] +memo = set() -def diff(l): -    m = max(l) -    return sorted(m - v for v in l)[1:] +def qpush(q, ai, bi, ci): +    t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci) +    if not t in memo: +        memo.add(t) +        heapq.heappush(q, t) -s = sum(map(max, [a, b, c])) -sa, sb, sc = list(map(diff, [a, b, c])) -da, db, dc = [0], [0], [0] -q = [0] -while k > 0: -    while True: -        if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]): -            for v in [sa[0] + bb + cc for bb in db for cc in dc]: -                heapq.heappush(q, v) -            da.append(sa[0]) -            sa = sa[1:] -        elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]): -            for v in [sb[0] + aa + cc for aa in da for cc in dc]: -                heapq.heappush(q, v) -            db.append(sb[0]) -            sb = sb[1:] -        elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]): -            for v in [sc[0] + aa + bb for aa in da for bb in db]: -                heapq.heappush(q, v) -            dc.append(sc[0]) -            sc = sc[1:] -        else: -            break -    v = heapq.heappop(q) -    print(s - v) -    k -= 1 +qpush(q, len(a) - 1, len(b) - 1, len(c) - 1) +for _ in range(k): +    s, ai, bi, ci = heapq.heappop(q) +    if ai > 0: +        qpush(q, ai - 1, bi, ci) +    if bi > 0: +        qpush(q, ai, bi - 1, ci) +    if ci > 0: +        qpush(q, ai, bi, ci - 1) +    print(-s)