CodeEff/ECCO huggingface dataset:
# Original solution
import sys
#import numpy as np

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

N = 10000
def tokey(i, j, k):
    return i*N*N + j*N + k
def dekey(n):
    i = int(n / N / N)
    j = int(n / N) % N
    k = n % N
    return i, j, k

def main():
    X, Y, Z, K = i2nn()
    A = i2nn()
    B = i2nn()
    C = i2nn()
    A.sort()
    A.reverse()
    B.sort()
    B.reverse()
    C.sort()
    C.reverse()
    Q = [(A[0] + B[0] + C[0], 0, 0, 0)]
    loop = 0
    stored = set()
    def next(i, j, k):
        if i >= X or j >= Y or k >= Z:
            return
        key = tokey(i, j, k)
        if key not in stored:
            stored.add(key)
            n = A[i] + B[j] + C[k]
            Q.append((n, i, j, k))
    while True:
        Q.sort(key=lambda v: v[0])
        v = Q.pop()
        print((v[0]))
        loop += 1
        if loop >= K:
            break
        next(v[1]+1, v[2], v[3])
        next(v[1], v[2]+1, v[3])
        next(v[1], v[2], v[3]+1)

main()


# Optimized solution
import sys
#import numpy as np

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

N = 10000
def tokey(i, j, k):
    return i*N*N + j*N + k
def dekey(n):
    i = int(n / N / N)
    j = int(n / N) % N
    k = n % N
    return i, j, k

def main():
    X, Y, Z, K = i2nn()
    A = i2nn()
    B = i2nn()
    C = i2nn()
    A.sort()
    A.reverse()
    B.sort()
    B.reverse()
    C.sort()
    C.reverse()
    Q = [(A[0] + B[0] + C[0], 0, 0, 0)]
    loop = 0
    stored = set()
    def next(i, j, k):
        if i >= X or j >= Y or k >= Z:
            return
        key = tokey(i, j, k)
        if key not in stored:
            stored.add(key)
            n = A[i] + B[j] + C[k]
            Q.append((n, i, j, k))
    while True:
        v = max(Q, key=lambda v: v[0])
        Q.remove(v)
        print((v[0]))
        loop += 1
        if loop >= K:
            break
        next(v[1]+1, v[2], v[3])
        next(v[1], v[2]+1, v[3])
        next(v[1], v[2], v[3]+1)

main()
# Original solution
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=1)
B.sort(reverse=1)
C.sort(reverse=1)

D = [0] * (min(k, x) * min(k, y))

for i in range(min(k, x)):
    for j in range(min(k, y)):
        D.append(A[i] + B[j])

D.sort(reverse=1)
E = [0] * (min(k, len(D)) * min(k, z))

for i in range(min(k, len(D))):
    for j in range(min(k, z)):
        E.append(D[i] + C[j])

E.sort(reverse=1)

for i in range(k):
    print((E[i]))

# Optimized solution
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=1)
B.sort(reverse=1)
C.sort(reverse=1)

D = []

for i in range(min(k, x)):
    for j in range(min(k, y)):
        for l in range(min(k, z)):
            if i*j*l <= k:
                D.append(A[i] + B[j] + C[l])
            else:
                break

D.sort(reverse=1)

for i in range(k):
    print((D[i]))
# Original solution
import itertools


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

AB = [a + b for (a, b) in list(itertools.product(A, B))]
AB = sorted(AB)[::-1]
ans = [ab + c for (ab, c) in list(itertools.product(AB[:3000], C))]
ans = sorted(ans)[::-1]
for i in range(K):
    print((ans[i]))


# Optimized solution
import itertools


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

AB = [a + b for (a, b) in list(itertools.product(A, B))]
AB.sort(reverse=True)
ans = [ab + c for (ab, c) in list(itertools.product(AB[:min(3000, X*Y*Z)], C))]
ans.sort(reverse=True)
for i in range(K):
    print((ans[i]))
# Original solution
from itertools import product, chain

x, y, z, k = list(map(int, input().split(" ")))
a = sorted(list(map(int, input().split(" "))))
b = sorted(list(map(int, input().split(" "))))
c = sorted(list(map(int, input().split(" "))))

apb_sorted = sorted([a + b for a, b in product(a, b)])
ans_list = sorted(
    list(chain.from_iterable([[_c + ab for ab in apb_sorted] for _c in c[:k]]))
)
it = reversed(ans_list)
for _ in range(k):
    print((next(it)))


# Optimized solution
from itertools import product, chain

x, y, z, k = list(map(int, input().split(" ")))
a = sorted(list(map(int, input().split(" "))))
b = sorted(list(map(int, input().split(" "))))
c = sorted(list(map(int, input().split(" "))))

apb_sorted = sorted([a + b for a, b in product(a, b)])[-k:]
ans_list = sorted(
    list(chain.from_iterable([[_c + ab for ab in apb_sorted] for _c in c[:k]]))
)
it = reversed(ans_list)
for _ in range(k):
    print((next(it)))
# Original solution
from itertools import product, chain
from collections import deque


def solver1(a, b, c, k):
    apb_sorted = sorted([a + b for a, b in product(a, b)])[-k:]
    ans_list = sorted(
        list(chain.from_iterable([[_c + ab for ab in apb_sorted] for _c in c[:k]]))
    )
    it = reversed(ans_list)
    for _ in range(k):
        print((next(it)))


def solver2(a, b, c, k):
    d = deque()
    n = len(a)
    m = min(k, n)
    for p in range(m):
        for q in range(m):
            for r in range(m):
                if (p + 1) * (q + 1) * (r + 1) > k:
                    continue
                d.append(a[-p - 1] + b[-q - 1] + c[-r - 1])
    it = reversed(sorted(d))
    for _ in range(k):
        print((next(it)))


if __name__ == "__main__":
    x, y, z, k = list(map(int, input().split(" ")))
    a = sorted(list(map(int, input().split(" "))))
    b = sorted(list(map(int, input().split(" "))))
    c = sorted(list(map(int, input().split(" "))))
    solver2(a, b, c, k)


# Optimized solution
from itertools import product, chain
from collections import deque


def solver1(a, b, c, k):
    apb_sorted = sorted([a + b for a, b in product(a, b)])[-k:]
    ans_list = sorted(
        list(chain.from_iterable([[_c + ab for ab in apb_sorted] for _c in c[:k]]))
    )
    it = reversed(ans_list)
    for _ in range(k):
        print((next(it)))


def solver2(a, b, c, k):
    n = len(a)
    m = min(k, n)
    pqr = deque()
    for p in range(m):
        for q in range(m):
            for r in range(m):
                if (p + 1) * (q + 1) * (r + 1) > k:
                    break
                else:
                    pqr.append(a[-p - 1] + b[-q - 1] + c[-r - 1])
    it = reversed(sorted(pqr))
    for _ in range(k):
        print((next(it)))


if __name__ == "__main__":
    x, y, z, k = list(map(int, input().split(" ")))
    a = sorted(list(map(int, input().split(" "))))
    b = sorted(list(map(int, input().split(" "))))
    c = sorted(list(map(int, input().split(" "))))
    solver2(a, b, c, k)
# Original solution
# -*- coding: utf-8 -*-

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

E = []
for i in range(X):
    for j in range(Y):
        E.append(A[i] + B[j])
E.sort(reverse=True)

F = []
for i in range(min(X * Y, K)):
    for j in range(Z):
        F.append(E[i] + C[j])
F.sort(reverse=True)

for i in range(K):
    print((F[i]))


# Optimized solution
# -*- coding: utf-8 -*-

X, Y, Z, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

Comb = []
for i in range(X):
    for j in range(Y):
        if (i + 1) * (j + 1) > K:
            break
        for k in range(Z):
            if (i + 1) * (j + 1) * (k + 1) > K:
                break
            Comb.append(A[i] + B[j] + C[k])

Comb.sort(reverse=True)
for i in range(K):
    print((Comb[i]))
# Original solution
l = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
z = [int(x) for x in input().split()]

result_l = []
for i in x:
    for j in y:
        for k in z:
            result_l.append(i+j+k)
result_l.sort(reverse=True)
for ind in range(l[-1]):
    print((result_l[ind]))

# Optimized solution
X, Y, Z, K = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort(reverse=True)
B = [int(x) for x in input().split()]
B.sort(reverse=True)
C = [int(x) for x in input().split()]
C.sort(reverse=True)


bi_comb = []
for i in A[:K]:
    for j in B[:K]:
        bi_comb.append(i+j)
bi_comb.sort(reverse=True)
tri_comb = []
for k in bi_comb[:K]:
    for l in C[:K]:
        tri_comb.append(k + l)
tri_comb.sort(reverse=True)

print(*tri_comb[:K], sep="\n")
# Original solution
X, Y, Z, K = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort(reverse=True)
B = [int(x) for x in input().split()]
B.sort(reverse=True)
C = [int(x) for x in input().split()]
C.sort(reverse=True)


bi_comb = []
for i in A[:K]:
    for j in B[:K]:
        bi_comb.append(i+j)
bi_comb.sort(reverse=True)
tri_comb = []
for k in bi_comb[:K]:
    for l in C[:K]:
        tri_comb.append(k + l)
tri_comb.sort(reverse=True)

print(*tri_comb[:K], sep="\n")


# Optimized solution
X, Y, Z, K = map(int, input().split())
A = sorted([int(x) for x in input().split()], reverse=True)
B = sorted([int(x) for x in input().split()], reverse=True)
C = sorted([int(x) for x in input().split()], reverse=True)

bi_comb = []
for i in range(min(X, K)):
    for j in range(min(Y, K)):
        if (i+1)*(j+1) > K:
            break
        bi_comb.append(A[i] + B[j])
bi_comb.sort(reverse=True)

tri_comb = []
for k in range(min(len(bi_comb), K)):
    for l in range(min(Z, K)):
        if (k+1)*(l+1) > K:
            break
        tri_comb.append(bi_comb[k] + C[l])
tri_comb.sort(reverse=True)

print(*tri_comb[:K], sep="\n")
# Original solution
x, y, z, k = list(map(int, input().split()))
m = []
for _ in range(3):
    m.append(sorted(list(map(int, input().split())), reverse=True))

def sorted_sum(list_a, list_b):
    s = []
    for x in list_a:
        for y in list_b:
            s.append(x + y)
    return sorted(s, reverse=True)

ans = sorted_sum(sorted_sum(m[0], m[1])[0:k], m[2])
for i in range(0, k):
    print((ans[i]))

# Optimized solution
x, y, z, k = list(map(int, input().split()))
m = []
for _ in range(3):
    m.append(sorted(list(map(int, input().split())), reverse=True))

def sorted_sum(list_a, list_b, limit):
    s = []
    for x in list_a:
        for y in list_b:
            s.append(x + y)
    return sorted(s, reverse=True)[0:limit]


def consume_diff(s, a_val, list_b, b_index):
    diff = a_val - list_b[b_index]
    for i in range(b_index + 1, len(list_b)):
        if list_b[b_index] - list_b[i] > diff:
            break
        s.append(a_val + list_b[i])



ans = sorted_sum(sorted_sum(m[0], m[1], k), m[2], k)
for i in range(min([k, len(ans)])):
    print((ans[i]))
# Original solution
import heapq

tmp = list(map(int, input().split()))
x = tmp[0]
y = tmp[1]
z = tmp[2]
k = tmp[3]
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)

#log = [[[False for _ in range(z)] for _ in range(y)] for _ in range(x)]
log = [[[False] * z for _ in range(y)] for _ in range(x)]
cnt = 0
h = []
heapq.heappush(h, (-(a[0]+b[0]+c[0]), 0, 0, 0))
for i in range(k): 
  tmp = heapq.heappop(h)
  print((-tmp[0]))
  if tmp[1]+1 < x and log[tmp[1]+1][tmp[2]][tmp[3]] == False:
    heapq.heappush(h, (-(a[tmp[1]+1]+b[tmp[2]]+c[tmp[3]]), tmp[1]+1, tmp[2], tmp[3]))
    log[tmp[1]+1][tmp[2]][tmp[3]] = True
  if tmp[2]+1 < y and log[tmp[1]][tmp[2]+1][tmp[3]] == False:
    heapq.heappush(h, (-(a[tmp[1]]+b[tmp[2]+1]+c[tmp[3]]), tmp[1], tmp[2]+1, tmp[3]))
    log[tmp[1]][tmp[2]+1][tmp[3]] = True
  if tmp[3]+1 < z and log[tmp[1]][tmp[2]][tmp[3]+1] == False:
    heapq.heappush(h, (-(a[tmp[1]]+b[tmp[2]]+c[tmp[3]+1]), tmp[1], tmp[2], tmp[3]+1))
    log[tmp[1]][tmp[2]][tmp[3]+1] = True

# Optimized solution
tmp = list(map(int, input().split()))
x = tmp[0]
y = tmp[1]
z = tmp[2]
k = tmp[3]
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)

ansl = []
for p in range(x):
  if p > k:
    break
  for q in range(y):
    if p * q > k:
      break
    for r in range(z):
      if p * q * r > k:
        break
      ansl.append(a[p] + b[q] + c[r])

ansl.sort(reverse=True)

for i in range(k):
  print((ansl[i]))
# Original solution
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()))
S = []
for x in A:
    for y in B:
        for z in C:
            S.append(x+y+z)
S.sort(reverse = True)
for i in range(K):
    print((S[i]))

# Optimized solution
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()))
S = []
for x in A:
    for y in B:
        S.append(x+y)
S.sort(reverse = True)
S1 = []
for i in range(min(K,X*Y)):
    for z in C:
        S1.append(S[i]+z)
S1.sort(reverse = True)
for i in range(K):
    print((S1[i]))
# Original solution
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()))
ans = []
for i in range(x):
    for j in range(y):
        for l in range(z):
            ans.append(a[i] + b[j] + c[l])
ans.sort(reverse=True)
for i in range(k):
    print((ans[i]))

# Optimized solution
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()))
ans = []
for i in range(x):
    for j in range(y):
        ans.append(a[i]+b[j])
ans.sort(reverse=True)
ans = ans[:k]
ans2 = []
for i in range(len(ans)):
    for j in range(z):
        ans2.append(ans[i]+c[j])
ans2.sort(reverse=True)
for i in range(k):
    print((ans2[i]))
# Original solution
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()))
c.sort(reverse=True)

p = [0 for _ in range(x * y)]
t = 0
for ai in a:
    for bi in b:
        p[t] = ai + bi
        t += 1
p.sort(reverse=True)
q = [0 for _ in range(k * z)]
t = 0
for pi in p[:k]:
    for ci in c[:k]:
        q[t] = pi + ci
        t += 1
q.sort(reverse=True)
for qi in q[:k]:
    print(qi)


# Optimized solution
x, y, z, kk = 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)

p = []
for i in range(x):
    for j in range(y):
        for k in range(z):
            if (i + 1) * (j + 1) * (k + 1) <= kk:
                p.append(a[i] + b[j] + c[k])
            else:
                break
p.sort(reverse=True)
for i in range(kk):
    print((p[i]))
# Original solution
X, Y, Z, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
s = []

for i in A:
    for j in B:
        for k in C:
            s.append(i+j+k)

s = sorted(s, reverse=True)

for i in range(K):
    print((s[i]))

# Optimized solution
X, Y, Z, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
e = []
s = []

for i in A:
    for j in B:
        e.append(i+j)
e = sorted(e, reverse=True)

if K<len(e):
    e = e[0:K]

for i in e:
    for j in C:
        s.append(i+j)

s = sorted(s, reverse=True)

for i in range(K):
    print((s[i]))
# Original solution
x,y,z,k=list(map(int,input().split()))
a=tuple(map(int,input().split()))
b=tuple(map(int,input().split()))
c=tuple(map(int,input().split()))
 
def f(p,q):
    return [i+j for j in q for i in p]
 
if x+y<y+z:
    for i in sorted(f(c,f(a,b)))[::-1][:k]:
        print(i)
elif x+z<y+z:
    for i in sorted(f(b,f(a,c)))[::-1][:k]:
        print(i)
else:
    for i in sorted(f(a,f(b,c)))[::-1][:k]:
        print(i)

# Optimized solution
x,y,z,k=list(map(int,input().split()))
a=tuple(map(int,input().split()))
b=tuple(map(int,input().split()))
c=tuple(map(int,input().split()))
 
def f(p,q):
    return sorted([i+j for j in q for i in p])[::-1][:k]
 
if x+y<y+z:
    for i in sorted(f(c,f(a,b)))[::-1][:k]:
        print(i)
elif x+z<y+z:
    for i in sorted(f(b,f(a,c)))[::-1][:k]:
        print(i)
else:
    for i in sorted(f(a,f(b,c)))[::-1][:k]:
        print(i)
# Original solution
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()))
ab=sorted(s+t for t in B for s in A)[-1:-K-1:-1]
abc=sorted(i+x for i in ab for x in C)[-1:-K-1:-1]
print(("\n".join(map(str,abc))))

# Optimized solution
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()))
ab=sorted(s+t for t in B for s in A)[-1:-K-1:-1]
abc=sorted(i+x for i in ab for x in C)[-1:-K-1:-1]
print(("\n".join(map(str,abc))))
# Original solution
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()))
ab=sorted(s+t for t in B for s in A)[-1:-K-1:-1]
abc=sorted(i+x for i in ab for x in C)[-1:-K-1:-1]
print(("\n".join(map(str,abc))))

# Optimized solution
X, Y, Z, K = map(int, input().split())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))
ab=sorted(s+t for t in B for s in A)[-1:-K-1:-1]
abc=sorted(i+x for i in ab for x in C)[-1:-K-1:-1]
print(*abc,sep="\n")
# Original solution
def binary_search_int(ok, ng, test, k, A, B):
    """
    :param ok: solve(x) = True を必ず満たす点
    :param ng: solve(x) = False を必ず満たす点
    """
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if test(mid, k, A, B):
            ok = mid
        else:
            ng = mid
    return ok

def get_cnt(x, A, B):
    """
    a+b<=x となるようなAの要素とBの要素の組の数 (A, Bはソート済み)
    """
    cnt = 0
    L = len(B)
    for a in A:
        cnt += L-bisect_left(B, x-a)
    return cnt

def test(x, k, A, B):
    """
    場合の数が k 個(以上)となるような最小の x を探索する関数
    a+b <= x で get_cnt(x,A,B) は同じ値を返すので、最小の x は A, Bの要素の和そのものに一致する
    """
    return get_cnt(x,A,B) >= k

###########################################################

import sys
input = sys.stdin.readline
from bisect import *

X, Y, Z, 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()
B.sort()
C.sort()

P = []
for k in range(1,K+1):
    tmp = binary_search_int(0, 10**11,test, k, A, B)
    if tmp != 0:
        P.append(tmp)
Q = []
P.sort()
for k in range(1,K+1):
    Q.append(binary_search_int(1, 10**11,test, k, P, C))
print(*Q, sep="\n")


# Optimized solution
from itertools import product
X, Y, Z, K = list(map(int, input().split()))
AB = []
for ab in product(list(map(int, input().split())), list(map(int, input().split()))):
    AB.append(ab[0] + ab[1])
AB.sort(reverse=True)
AB = AB[:K]
ABC = []
for abc in product(AB, list(map(int, input().split()))):
    ABC.append(abc[0]+abc[1])
ABC.sort(reverse=True)
for i in range(K):
    print((ABC[i]))
# Original solution
from itertools import product
X, Y, Z, K = list(map(int, input().split()))
AB = []
for ab in product(list(map(int, input().split())), list(map(int, input().split()))):
    AB.append(ab[0] + ab[1])
AB.sort(reverse=True)
AB = AB[:K]
ABC = []
for abc in product(AB, list(map(int, input().split()))):
    ABC.append(abc[0]+abc[1])
ABC.sort(reverse=True)
for i in range(K):
    print((ABC[i]))


# Optimized solution
from itertools import product
X, Y, Z, K = list(map(int, input().split()))
AB = []
for ab in product(list(map(int, input().split())), list(map(int, input().split()))):
    AB.append(ab[0] + ab[1])
AB.sort(reverse=True)
AB = AB[:min(K,X*Y)]
ABC = []
for abc in product(AB, list(map(int, input().split()))):
    ABC.append(abc[0]+abc[1])
ABC.sort(reverse=True)
for i in range(K):
    print((ABC[i]))
# Original solution
#!/usr/bin/env python3
(x, y, z, k), a, b, c = [[*list(map(int, o.split()))] for o in open(0)]
a.sort(); b.sort(); c.sort()

p = a[-1] + b[-1] + c[-1]
s, h = {(p, -1, -1, -1)}, [(-p, -1, -1, -1)]

from heapq import*
def push(i, j, k):
    global s, h
    try:
        t = a[i] + b[j] + c[k]
    except IndexError:
        return
    if (t, i, j, k) not in s:
        heappush(h, (-t, i, j, k))
        s |= {(t, i, j, k)}

for _ in [0] * k:
    p, i, j, k = heappop(h)
    print((-p))
    push(i, j, k - 1)
    push(i, j - 1, k)
    push(i - 1, j, k)

# Optimized solution
#!/usr/bin/env python3
(x, y, z, k), a, b, c = [[*list(map(int, o.split()))] for o in open(0)]
a.sort(); b.sort(); c.sort()

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

from heapq import*
def push(i, j, k):
    global s, h
    try:
        t = (- (a[i] + b[j] + c[k]), i, j, k)
    except IndexError:
        return
    if t not in s:
        heappush(h, t)
        s |= {t}

for _ in [0] * k:
    p, i, j, k = heappop(h)
    print((-p))
    push(i, j, k - 1)
    push(i, j - 1, k)
    push(i - 1, j, k)
# Original solution
from queue import PriorityQueue
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)
A.append(-float('inf'))
B.sort(reverse=True)
B.append(-float('inf'))
C.sort(reverse=True)
C.append(-float('inf'))

pq = PriorityQueue()
pq.put((-(A[0]+B[0]+C[0]),0,0,0))
count = 0
queued = set([(0,0,0)])
while True:
  d,i,j,k = pq.get()
  #print(-d,i,j,k)
  print((-d))
  count += 1
  if count >= K:
    break
  for l in [i,i+1]:
    for m in [j,j+1]:
      for n in [k,k+1]:
        if (l,m,n) in queued:
          continue
        else:
          pq.put((-(A[l]+B[m]+C[n]),l,m,n))
          queued.add((l,m,n))

# Optimized solution
from heapq import heappop, heappush
from time import time

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)
A.append(-float('inf'))
B.sort(reverse=True)
B.append(-float('inf'))
C.sort(reverse=True)
C.append(-float('inf'))

hq = []
count = 0
queued = set()
heappush(hq,(-(A[0]+B[0]+C[0]),time(),0,0,0))
queued.add((0,0,0))
while True:
  d,_,i,j,k = heappop(hq)
  #print(-d,i,j,k)
  print((-d))
  count += 1
  if count >= K:
    break
  for l in [i,i+1]:
    for m in [j,j+1]:
      for n in [k,k+1]:
        if (l,m,n) in queued:
          continue
        else:
          heappush(hq,(-(A[l]+B[m]+C[n]),time(),l,m,n))
          queued.add((l,m,n))