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

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

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

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



aabb = [a + b for a in aaa for b in bbb]

aabb.sort(reverse=True)

aabb = aabb[:k]



aabbcc = [ab + c for ab in aabb for c in ccc]

aabbcc.sort(reverse=True)

aabbcc = aabbcc[:k]



print(('\n'.join(map(str, aabbcc))))

from heapq import heappop, heappush



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

aaa = sorted(map(int, input().split()), reverse=True)

bbb = sorted(map(int, input().split()), reverse=True)

ccc = sorted(map(int, input().split()), reverse=True)



q = [(-(aaa[0] + bbb[0] + ccc[0]), 0, 0, 0)]

ans = []

added = {(0, 0, 0)}

for _ in [0] * k:

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

    ans.append(-s)

    for da, db, dc in ((1, 0, 0), (0, 1, 0), (0, 0, 1)):

        aj, bj, cj = ai + da, bi + db, ci + dc

        if aj >= x or bj >= y or cj >= z:

            continue

        if (aj, bj, cj) in added:

            continue

        added.add((aj, bj, cj))

        heappush(q, (-(aaa[aj] + bbb[bj] + ccc[cj]), aj, bj, cj))



print(('\n'.join(map(str, ans))))

x, y, z, k = list(map(int, input().split()))
aaa = list(map(int, input().split()))
bbb = list(map(int, input().split()))
ccc = list(map(int, input().split()))
aabb = [a + b for a in aaa for b in bbb]
aabb.sort(reverse=True)
aabb = aabb[:k]
aabbcc = [ab + c for ab in aabb for c in ccc]
aabbcc.sort(reverse=True)
aabbcc = aabbcc[:k]
print(("\n".join(map(str, aabbcc))))

from heapq import heappop, heappush

x, y, z, k = list(map(int, input().split()))
aaa = sorted(map(int, input().split()), reverse=True)
bbb = sorted(map(int, input().split()), reverse=True)
ccc = sorted(map(int, input().split()), reverse=True)
q = [(-(aaa[0] + bbb[0] + ccc[0]), 0, 0, 0)]
ans = []
added = {(0, 0, 0)}
for _ in [0] * k:
    s, ai, bi, ci = heappop(q)
    ans.append(-s)
    for da, db, dc in ((1, 0, 0), (0, 1, 0), (0, 0, 1)):
        aj, bj, cj = ai + da, bi + db, ci + dc
        if aj >= x or bj >= y or cj >= z:
            continue
        if (aj, bj, cj) in added:
            continue
        added.add((aj, bj, cj))
        heappush(q, (-(aaa[aj] + bbb[bj] + ccc[cj]), aj, bj, cj))
print(("\n".join(map(str, ans))))

+from heapq import heappop, heappush + -aaa = list(map(int, input().split())) -bbb = list(map(int, input().split())) -ccc = list(map(int, input().split())) -aabb = [a + b for a in aaa for b in bbb] -aabb.sort(reverse=True) -aabb = aabb[:k] -aabbcc = [ab + c for ab in aabb for c in ccc] -aabbcc.sort(reverse=True) -aabbcc = aabbcc[:k] -print(("\n".join(map(str, aabbcc)))) +aaa = sorted(map(int, input().split()), reverse=True) +bbb = sorted(map(int, input().split()), reverse=True) +ccc = sorted(map(int, input().split()), reverse=True) +q = [(-(aaa[0] + bbb[0] + ccc[0]), 0, 0, 0)] +ans = [] +added = {(0, 0, 0)} +for _ in [0] * k: +    s, ai, bi, ci = heappop(q) +    ans.append(-s) +    for da, db, dc in ((1, 0, 0), (0, 1, 0), (0, 0, 1)): +        aj, bj, cj = ai + da, bi + db, ci + dc +        if aj >= x or bj >= y or cj >= z: +            continue +        if (aj, bj, cj) in added: +            continue +        added.add((aj, bj, cj)) +        heappush(q, (-(aaa[aj] + bbb[bj] + ccc[cj]), aj, bj, cj)) +print(("\n".join(map(str, ans))))