CodeEff/ECCO huggingface dataset:
# Original solution
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()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
 
n = []
heapq.heapify(n)
heapq.heappush(n, (-(a[0]+b[0] + c[0]), 0,0,0))
for i in range(K):
    (m, j, k, l) = heapq.heappop(n)
    print((-m))
    if j + 1 <=x-1:
        s = (-(a[j+1]+b[k]+c[l]), j+1, k, l)
        if s not in n:
            heapq.heappush(n ,s)
 
    if k + 1 <=y-1:
        s = (-(a[j]+b[k+1]+c[l]), j, k+1, l)
        if s not in n:
            heapq.heappush(n ,s)
    
    if l+ 1 <=z-1:
        s = (-(a[j]+b[k]+c[l+1]), j, k, l+1)
        if s not in n:
            heapq.heappush(n ,s)

# Optimized solution
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()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
ans = [(-(a[0]+b[0]+c[0]), 0, 0, 0)]
for i in range(K):
    m, j, k, h = heapq.heappop(ans)
    print((-m))
    if j+1 <= X-1:
        s =(-(a[j+1]+b[k]+c[h]), j+1, k, h)
        if s not in ans:
            heapq.heappush(ans, s)
    if k+1 <= Y-1:
        s =(-(a[j]+b[k+1]+c[h]), j , k+1, h)
        if s not in ans:
            heapq.heappush(ans, s)
    if h+1 <= Z-1:
        s =(-(a[j]+b[k]+c[h+1]), j , k, h+1)
        if s not in ans:
            heapq.heappush(ans, s)
# 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 aa in a:
    for bb in b:
        for cc in c:
            ans.append(aa+bb+cc)

for ansi in sorted(ans)[::-1][:k]:
    print(ansi)

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


ab = []
for aa in a:
    for bb in b:
        ab.append(aa+bb)

ab = sorted(ab)[::-1][:k]

ans = []
for aabb in ab:
    for cc in c:
        ans.append(aabb+cc)

for ansi in sorted(ans)[::-1][:k]:
    print(ansi)
# Original solution
x, y, z, k = list(map(int, input().split()))
a_array = sorted([int(x) for x in input().split()], reverse=True)
b_array = sorted([int(x) for x in input().split()], reverse=True)
c_array = sorted([int(x) for x in input().split()], reverse=True)


def solver1():
    ab_array = [x + y for x in a_array for y in b_array]
    abc_array = sorted([ab + c for ab in ab_array for c in c_array], reverse=True)
    for abc in abc_array[:k]:
        print(abc)


solver1()


# Optimized solution
x, y, z, k = list(map(int, input().split()))
a_array = sorted([int(x) for x in input().split()], reverse=True)
b_array = sorted([int(x) for x in input().split()], reverse=True)
c_array = sorted([int(x) for x in input().split()], reverse=True)


def solver1():
    ab_array = sorted([x + y for x in a_array for y in b_array], reverse=True)[:3000]
    abc_array = sorted([ab + c for ab in ab_array for c in c_array], reverse=True)
    for abc in abc_array[:k]:
        print(abc)


solver1()
# Original solution
# D - Cake 123

import heapq
import itertools

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

A = list(int(a) for a in input().split())
B = list(int(b) for b in input().split())
C = list(int(c) for c in input().split())

hq = []
for i, j in itertools.product(A, B):
    heapq.heappush(hq, (i+j)*-1)

AB = []
while len(hq)>0 and len(AB)<=k:
    AB.append(heapq.heappop(hq)*-1)

hq = []
for i, j in itertools.product(AB, C):
    heapq.heappush(hq, (i+j)*-1)

for _ in range(k):
    print((heapq.heappop(hq)*-1))

# Optimized solution
# D - Cake 123

import heapq
import itertools

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

A = list(int(a) for a in input().split())
B = list(int(b) for b in input().split())
C = list(int(c) for c in input().split())


A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

hq = []
for i in range(x):
    for j in range(y):
        for l in range(z):
            if (i+1)*(j+1)*(l+1)<=k:
                heapq.heappush(hq, (A[i]+B[j]+C[l])*-1)
            else:
                break

'''
hq = []
for i, j in itertools.product(A, B):
    heapq.heappush(hq, (i+j)*-1)

AB = []
while len(hq)>0 and len(AB)<=k:
    AB.append(heapq.heappop(hq)*-1)

hq = []
for i, j in itertools.product(AB, C):
    heapq.heappush(hq, (i+j)*-1)
'''

for _ in range(k):
    print((heapq.heappop(hq)*-1))
# 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= True)
B.sort(reverse= True)
C.sort(reverse= True)
LIS = []
for i in range(X):
    for j in range(Y):
        for k in range(min((3000//(i+1)*(j+1)),Z)):
            SUM = A[i] + B[j] + C[k]
            LIS.append(SUM)
LIS.sort(reverse = True)
for i in range(K):
    print((LIS[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= True)
B.sort(reverse= True)
C.sort(reverse= True)
LIS = []
for i in range(X):
    INTB = 3000//(i+1)
    for j in range(min(INTB+1,Y)):
        INT = 3000//((i+1)*(j+1))
        for k in range(min(INT+1,Z)):
            SUM = A[i] + B[j] + C[k]
            LIS.append(SUM)
LIS.sort(reverse = True)
for i in range(K):
    print((LIS[i]))
# Original solution
def int_raw():
    return int(eval(input()))

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int,ss_raw()))

X,Y,Z,K = ints_raw()

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)
def main():
    D = []
    for a in A:
        for b in B:
            D.append(a+b)
    D.sort(reverse=True)
    D = D[:K+1]
    E =[]
    for d in D:
        for c in C:
            E.append(d+c)
    E.sort(reverse=True)
    for e in range(K):
        print((E[e]))

main()


# Optimized solution
def int_raw():
    return int(eval(input()))

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int,ss_raw()))

X,Y,Z,K = ints_raw()

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)
def main():
    D = [a+b for a in A for b in B]
    D.sort(reverse=True)
    D = D[:K+1]
    E =[d+c for d in D for c in C]
    E.sort(reverse=True)
    for e in range(K):
        print((E[e]))

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()))
#入力受け取り



AA = []
BB = []
CC = []

for k in range(min(X, K)):
	maxA = max(A)
	A.remove(maxA)
	AA.append(maxA)
for k in range(min(Y, K)):
	maxB = max(B)
	B.remove(max(B))
	BB.append(maxB)
for k in range(min(Z, K)):
	maxC = max(C)
	C.remove(maxC)
	CC.append(maxC)
#list X から X に大きい順にポイントを格納。



indexlist  = []
for k in range(min(X, K)):
	for l in range(min(Y, K)):
		for m in range(min(Z, K)):
			indexlist.append([k, l, m])
#インデックスを参照することで大きい順にポイントの組を取得できるような「リストのリスト」を作成


dictionary = {}
for P in indexlist:
	p = AA[P[0]] + BB[P[1]] + CC[P[2]]
	dictionary.update({str(P[0]) +" , " + str(P[1]) +" , " + str(P[2]): p})
#indexlist 引数の組を取り出し、対応するポイントを足し算して辞書に格納



Ans = list(dictionary.values())
for k in range(K):
	print((max(Ans)))
	Ans.remove(max(Ans))




# 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()))
#入力受け取り



AA = []
BB = []
CC = []

for k in range(min(X, K)):
	maxA = max(A)
	A.remove(maxA)
	AA.append(maxA)
for k in range(min(Y, K)):
	maxB = max(B)
	B.remove(maxB)
	BB.append(maxB)
for k in range(min(Z, K)):
	maxC = max(C)
	C.remove(maxC)
	CC.append(maxC)
#list X から X に大きい順にポイントを格納。



indexlist  = []
for k in range(min(X, K)):
	for l in range(min(Y, K)):
		for m in range(min(Z, K)):
			if k*l*m <= K:
				indexlist.append([k, l, m])
#インデックスを参照することで大きい順にポイントの組を取得できるような「リストのリスト」を作成


dictionary = {}
for P in indexlist:
	p = AA[P[0]] + BB[P[1]] + CC[P[2]]
	dictionary.update({str(P[0]) +" , " + str(P[1]) +" , " + str(P[2]): p})
#indexlist 引数の組を取り出し、対応するポイントを足し算して辞書に格納


Ans = list(dictionary.values())
for k in range(K):
	print((max(Ans)))
	Ans.remove(max(Ans))
# Original solution
# PDFで解法が4つも書いてある。これはその最初の解法

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

aa = list(map(int, input().split() ))
bb = list(map(int, input().split() ))
cc = list(map(int, input().split() ))

aa.sort(reverse = True)
bb.sort(reverse = True)
cc.sort(reverse = True)
# 降順＝大きい方から順

ab = []
for i in aa:
	for j in bb:
		ab.append(i + j)

# ab = [i + j for i in aa for j in bb]
# appendを使うと遅いので、二重の内包記法を使う 
# 外側でaaの要素、内側でbbの要素が動いていく。今回はどっちでも良いけど。
ab.sort(reverse = True)

max_len = min(k, len(ab))
abc = []
for i in ab[:max_len]:
	for j in cc:
		abc.append(i + j)

# abc = [i + j for i in ab[:max_len] for j in cc]
abc.sort(reverse = True)

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


# Optimized solution
# PDFで解法が4つも書いてある。これはその最初の解法

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

aa = list(map(int, input().split() ))
bb = list(map(int, input().split() ))
cc = list(map(int, input().split() ))

aa.sort(reverse = True)
bb.sort(reverse = True)
cc.sort(reverse = True)
# 降順＝大きい方から順

ab = [i + j for i in aa for j in bb]
# appendを使うと遅いので、二重の内包記法を使う 
# 外側でaaの要素、内側でbbの要素が動いていく。今回はどっちでも良いけど。
ab.sort(reverse = True)

max_len = min(k, len(ab))
abc = [i + j for i in ab[:max_len] for j in cc]
abc.sort(reverse = True)

for i in range(k):
	print((abc[i]))
# Original solution
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines

INF = 10 ** 10 + 7


def main():
    X, Y, Z, K = list(map(int, readline().split()))
    A = sorted(list(map(int, readline().split())), reverse=True)
    B = sorted(list(map(int, readline().split())), reverse=True)
    C = sorted(list(map(int, readline().split())), reverse=True)

    ans = solve1(X, Y, Z, K, A, B, C)
    print(('\n'.join(map(str, ans))))


def solve1(X, Y, Z, K, A, B, C):

    AB = []
    for i in range(X):
        for j in range(Y):
            AB.append(A[i] + B[j])

    AB.sort(reverse=True)
    AB = AB[:min(X * Y, K)]

    ABC = []
    for i in range(len(AB)):
        for j in range(Z):
            ABC.append(AB[i] + C[j])

    ABC.sort(reverse=True)

    return ABC[:K]


if __name__ == '__main__':
    main()


# Optimized solution
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines

INF = 10 ** 10 + 7


def main():
    X, Y, Z, K = list(map(int, readline().split()))
    A = sorted(list(map(int, readline().split())), reverse=True)
    B = sorted(list(map(int, readline().split())), reverse=True)
    C = sorted(list(map(int, readline().split())), reverse=True)

    ans = solve2(X, Y, Z, K, A, B, C)
    print(('\n'.join(map(str, ans))))


def solve2(X, Y, Z, K, A, B, C):

    ABC = []
    for i in range(X):
        if (i + 1) > K:
            break
        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
                else:
                    ABC.append(A[i] + B[j] + C[k])

    return sorted(ABC, reverse=True)[:K]


def solve1(X, Y, Z, K, A, B, C):

    AB = []
    for i in range(X):
        for j in range(Y):
            AB.append(A[i] + B[j])

    AB.sort(reverse=True)
    AB = AB[:min(X * Y, K)]

    ABC = []
    for i in range(len(AB)):
        for j in range(Z):
            ABC.append(AB[i] + C[j])

    ABC.sort(reverse=True)

    return ABC[:K]


if __name__ == '__main__':
    main()
# Original solution
def main():
	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()))
	d = [0]*x*y
	for i in range(x):
		for j in range(y):
			d[i*y+j] = a[i]+b[j]
	d.sort(reverse=True)
	c.sort(reverse=True)

	c_len = min(k, z)
	d_len = min(k, x*y)
	e = [0]*d_len*c_len
	for i in range(d_len):
		for j in range(c_len):
			e[i*c_len+j] = d[i] + c[j]
	e.sort(reverse=True)
	for i in range(k):
		print((e[i]))


if __name__ == '__main__':
    main()

# Optimized solution
def main():
	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()))

	solve(a, b, c, x, y, z, k)

def solve(a, b, c, x, y, z, k):
	a.sort(reverse=True)
	b.sort(reverse=True)
	c.sort(reverse=True)
	stack = list()
	for p in range(x):
		for q in range(y):
			if (p+1)*(q+1) > k:
				break
			for r in range(z):
				if (p+1)*(q+1)*(r+1) > k:
					break
				stack.append(a[p]+b[q]+c[r])
	stack.sort(reverse=True)
	for i in range(k):
		print((stack[i]))

if __name__ == '__main__':
    main()
# Original solution
import heapq
x,y,z,k = list(map(int,input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
al = [[[0 for i in range(z)] for j in range(y)] for jj in range(x)]

hq = []
heapq.heappush(hq,(-(a[0]+b[0]+c[0]),0,0,0))
for i in range(k):
    hqi,ai,bi,ci = heapq.heappop(hq)
    print((-hqi))
    if ai+1 < x and al[ai+1][bi][ci] == 0:
        heapq.heappush(hq,(-(a[ai+1]+b[bi]+c[ci]),ai+1,bi,ci))
        al[ai+1][bi][ci] = -1
    if bi+1 < y and al[ai][bi+1][ci] == 0:
        heapq.heappush(hq,(-(a[ai]+b[bi+1]+c[ci]),ai,bi+1,ci))
        al[ai][bi+1][ci] = -1
    if ci+1 < z and al[ai][bi][ci+1] == 0:
        heapq.heappush(hq,(-(a[ai]+b[bi]+c[ci+1]),ai,bi,ci+1))
        al[ai][bi][ci+1] = -1


# Optimized solution
import heapq
x,y,z,k = list(map(int,input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
al = []

hq = []
heapq.heappush(hq,(-(a[0]+b[0]+c[0]),0,0,0))
for i in range(k):
    hqi,ai,bi,ci = heapq.heappop(hq)
    print((-hqi))
    if ai+1 < x and not (ai+1,bi,ci) in al:
        heapq.heappush(hq,(-(a[ai+1]+b[bi]+c[ci]),ai+1,bi,ci))
        al.append((ai+1,bi,ci))
    if bi+1 < y and not (ai,bi+1,ci) in al:
        heapq.heappush(hq,(-(a[ai]+b[bi+1]+c[ci]),ai,bi+1,ci))
        al.append((ai,bi+1,ci))
    if ci+1 < z and not (ai,bi,ci+1) in al:
        heapq.heappush(hq,(-(a[ai]+b[bi]+c[ci+1]),ai,bi,ci+1))
        al.append((ai,bi,ci+1))
# 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()
B.sort()
C.sort()
from heapq import heappush,heappop
ans=[]
data=[(-A[-1]-B[-1]-C[-1],X-1,Y-1,Z-1)]
visited=set()
while len(ans)<K:
    now=heappop(data)
    if (now[1],now[2],now[3]) not in visited:
        ans.append(-1*now[0])
        visited|={(now[1],now[2],now[3])}
    if now[1]>0:
        nex=now[0]+A[now[1]]-A[now[1]-1]
        heappush(data,(nex,now[1]-1,now[2],now[3]))
    if now[2]>0:
        nex=now[0]+B[now[2]]-B[now[2]-1]
        heappush(data,(nex,now[1],now[2]-1,now[3]))
    if now[3]>0:
        nex=now[0]+C[now[3]]-C[now[3]-1]
        heappush(data,(nex,now[1],now[2],now[3]-1))
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()))
A.sort()
B.sort()
C.sort()
from heapq import heappush,heappop
ans=[]
data=[(-A[-1]-B[-1]-C[-1],X-1,Y-1,Z-1)]
visited={(X-1,Y-1,Z-1)}
while len(ans)<K:
    now=heappop(data)
    ans.append(-1*now[0])
    if now[1]>0 and (now[1]-1,now[2],now[3]) not in visited:
        nex=now[0]+A[now[1]]-A[now[1]-1]
        heappush(data,(nex,now[1]-1,now[2],now[3]))
        visited|={(now[1]-1,now[2],now[3])}
    if now[2]>0 and (now[1],now[2]-1,now[3]) not in visited:
        nex=now[0]+B[now[2]]-B[now[2]-1]
        heappush(data,(nex,now[1],now[2]-1,now[3]))
        visited|={(now[1],now[2]-1,now[3])}
    if now[3]>0 and (now[1],now[2],now[3]-1) not in visited:
        nex=now[0]+C[now[3]]-C[now[3]-1]
        heappush(data,(nex,now[1],now[2],now[3]-1))
        visited|={(now[1],now[2],now[3]-1)}
for i in range(K):
    print((ans[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)
C=C[:K]

from itertools import product
D=sorted([a+b for a,b in product(A,B)],reverse=True)
D=D[:K]

E=sorted([d+c for d,c in product(D,C)],reverse=True)
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=True)
B.sort(reverse=True)
C.sort(reverse=True)
C=C[:K]

from itertools import product
D=sorted([a+b for a,b in product(A,B)],reverse=True)
D=D[:K]
E=sorted([d+c for d,c in product(D,C)],reverse=True)
E=E[:K]
for i in range(K):
    print((E[i]))
# Original solution
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


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

from itertools import product

AB = [a + b for a, b in product(A, B)]
AB.sort(reverse=True)

ABC = [ab + c for ab, c in product(AB[:K], C)]
ABC.sort(reverse=True)

ABC = ABC[:K]

print(*ABC, sep='\n')



# Optimized solution
# 全探索に終了条件を追加することで計算量を削減させるやり方
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


X, Y, Z, K = read_ints()
A = read_ints()
B = read_ints()
C = read_ints()

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

ABC = []
for a in range(X):
    if a + 1 > K:
        break
    for b in range(Y):
        if (a + 1) * (b + 1) > K:
            break
        for c in range(Z):
            # a,b,cはA,B,Cの上から何番目に大きいか
            if (a + 1) * (b + 1) * (c + 1) > K:
                break
            ABC.append(A[a] + B[b] + C[c])


ABC.sort(reverse=True)
ABC = ABC[:K]
print(*ABC, sep='\n')
# Original solution
# ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では？
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


X, Y, Z, K = read_ints()
A = read_ints()
B = read_ints()
C = read_ints()

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

heap = []  # ヒープといっても順序を工夫したただのリスト

from queue import PriorityQueue
heap = PriorityQueue()
heap.put((-(A[0] + B[0] + C[0]), 0, 0, 0))

considerd = set()

ans = []
for k_th in range(1, K+1):
    heap_max, i, j, k = heap.get()
    # print(heap_max)
    ans.append(-heap_max)
    for di, dj, dk in zip([1, 0, 0], [0, 1, 0], [0, 0, 1]):
        i_new, j_new, k_new = i + di, j + dj, k + dk
        if i_new >= X or j_new >= Y or k_new >= Z:
            continue
        if (i_new, j_new, k_new) in considerd:
            continue
        considerd.add((i_new, j_new, k_new))
        heap.put((-(A[i_new] + B[j_new] + C[k_new]), i_new, j_new, k_new))


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


# Optimized solution
# ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では？
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


X, Y, Z, K = read_ints()
A = read_ints()
B = read_ints()
C = read_ints()

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

heap = []  # ヒープといっても順序を工夫したただのリスト

from heapq import heapify, heappop, heappush, heappushpop
heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0))

ans = []
considerd = set()
for k_th in range(1, K+1):
    heap_max, i, j, k = heappop(heap)
    # print(heap_max)
    ans.append(-heap_max)
    for di, dj, dk in zip([1, 0, 0], [0, 1, 0], [0, 0, 1]):
        i_new, j_new, k_new = i + di, j + dj, k + dk
        if i_new >= X or j_new >= Y or k_new >= Z:
            continue
        if (i_new, j_new, k_new) in considerd:  # ここが計算量がおおい
            continue
        considerd.add((i_new, j_new, k_new))
        heappush(heap, (-(A[i_new] + B[j_new] + C[k_new]), i_new, j_new, k_new))
        # print(heap)


print(*ans, sep='\n')
# Original solution
# ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では？
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


X, Y, Z, K = read_ints()
A = read_ints()
B = read_ints()
C = read_ints()

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)


from heapq import heapify, heappop, heappush, heappushpop


class PriorityQueue:
    def __init__(self, heap):
        '''
        heap ... list
        '''
        self.heap = heap
        heapify(self.heap)

    def push(self, item):
        heappush(self.heap, item)

    def pop(self):
        return heappop(self.heap)

    def pushpop(self, item):
        return heappushpop(self.heap, item)

    def __call__(self):
        return self.heap


heap = []  # ヒープといっても順序を工夫したただのリスト

q = PriorityQueue(heap)
q.push((-(A[0] + B[0] + C[0]), 0, 0, 0))

ans = []
for k_th in range(1, K+1):
    heap_max, i, j, k = q.pop()
    # print(heap_max)
    ans.append(-heap_max)
    for di, dj, dk in zip([1, 0, 0], [0, 1, 0], [0, 0, 1]):
        i_new, j_new, k_new = i + di, j + dj, k + dk
        if i_new >= X or j_new >= Y or k_new >= Z:
            continue
        tmp = (-(A[i_new] + B[j_new] + C[k_new]), i_new, j_new, k_new)
        if tmp in q():  # ここが計算量がおおい
            continue
        q.push(tmp)


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


# Optimized solution
# ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では？
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


X, Y, Z, K = read_ints()
A = read_ints()
B = read_ints()
C = read_ints()

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)


from heapq import heapify, heappop, heappush, heappushpop


class PriorityQueue:
    def __init__(self, heap):
        '''
        heap ... list
        '''
        self.heap = heap
        heapify(self.heap)

    def push(self, item):
        heappush(self.heap, item)

    def pop(self):
        return heappop(self.heap)

    def pushpop(self, item):
        return heappushpop(self.heap, item)

    def __call__(self):
        return self.heap


heap = []  # ヒープといっても順序を工夫したただのリスト

q = PriorityQueue(heap)
q.push((-(A[0] + B[0] + C[0]), 0, 0, 0))

considered = set()
ans = []
for k_th in range(1, K+1):
    heap_max, i, j, k = q.pop()
    ans.append(-heap_max)
    for di, dj, dk in zip([1, 0, 0], [0, 1, 0], [0, 0, 1]):
        i_new, j_new, k_new = i + di, j + dj, k + dk
        if i_new >= X or j_new >= Y or k_new >= Z:
            continue
        if (i_new, j_new, k_new) in considered:
            continue
        considered.add((i_new, j_new, k_new))
        q.push((-(A[i_new] + B[j_new] + C[k_new]), i_new, j_new, k_new))


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