CodeEff/ECCO huggingface dataset:
# Original solution
#coding:utf-8
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = True

def main():
    X,Y,Z,K = LMIIS()
    A = LMIIS()
    B = LMIIS()
    C = LMIIS()
    

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

    ABC = []
    for ab in AB[:K]:
        for c in C:
            ABC.append(ab+c)
    ABC.sort(reverse=True)
    for i in range(K):
        print(ABC[i])

    pass
if __name__ == '__main__':
    main()


# Optimized solution
#coding:utf-8
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = True

def main():
    X,Y,Z,K = LMIIS()
    A = LMIIS()
    B = LMIIS()
    C = LMIIS()
    
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)
    ans = []
    for ai in range(X):
        for bi in range(Y):
            if ai * bi > K:
                break
            for ci in range(Z):
                if ai * bi * ci > K:
                    break
                
                ans.append(A[ai]+B[bi]+C[ci])
    ans.sort(reverse=True)
    for i in range(K):
        print(ans[i])


    
    


if __name__ == '__main__':
    main()
# Original solution
from collections import deque
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()))

out = deque()

for i in range(X):
    for j in range(Y):
        for k in range(Z):
            out.append(A[i]+B[j]+C[k])
out = list(out)
out.sort(reverse = True)
for i in range(K):
    print((out[i]))

# Optimized solution
from collections import deque
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()))

out = deque()
out2 = deque()

for i in range(X):
    for j in range(Y):
        out.append(A[i]+B[j])
out = list(out)
out.sort(reverse = True)
del out[K:]
for i in range(len(out)):
    for j in range(Z):
        out2.append(out[i]+C[j])
out2 = list(out2)
out2.sort(reverse = True)
for i in range(K):
    print((out2[i]))
# Original solution
from collections import deque
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()))

out = deque()
out2 = deque()

for i in range(X):
    for j in range(Y):
        out.append(A[i]+B[j])
out = list(out)
out.sort(reverse = True)
del out[K:]
for i in range(len(out)):
    for j in range(Z):
        out2.append(out[i]+C[j])
out2 = list(out2)
out2.sort(reverse = True)
for i in range(K):
    print((out2[i]))


# Optimized solution
from collections import deque
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()))

out = deque()
out2 = deque()

for i in range(X):
    for j in range(Y):
        out.append(A[i]+B[j])
out = sorted(out, reverse=True)
del out[K:]
for i in range(len(out)):
    for j in range(Z):
        out2.append(out[i]+C[j])
out2 = sorted(out2, reverse=True)
for i in range(K):
    print((out2[i]))
# Original solution
from functools import lru_cache

numbers = input().split()
x = input().split()
y = input().split()
z = input().split()

k = int(numbers[3])


x.sort(reverse=True)
y.sort(reverse=True)
z.sort(reverse=True)

answer = []
for i in x:
    for j in y:
        for m in z:
            price = int(i)+int(j)+int(m)
            answer.append(price)

answer.sort(reverse=True)
del answer[k::]

for l in answer:
    print(l)


# Optimized solution
numbers = input().split()
x = input().split()
y = input().split()
z = input().split()

k = int(numbers[3])

answer = []
for i in x:
    for j in y:
        price = int(i)+int(j)
        answer.append(price)
answer.sort(reverse=True)
del answer[k::]
f_ans = []
for m in answer:
    for n in z:
        price = m + int(n)
        f_ans.append(price)

f_ans.sort(reverse=True)
del f_ans[k::]

for l in f_ans:
    print(l)
# Original solution
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)

X, Y, Z, K = mapint()
Xs = list(mapint())
Ys = list(mapint())
Zs = list(mapint())
Xs.sort(reverse=True)
Ys.sort(reverse=True)
Zs.sort(reverse=True)

x, y, z = 0, 0, 0
from heapq import heappop, heappush
Q = []
heappush(Q, (-(Xs[x]+Ys[y]+Zs[z]), (x, y, z)))
s = set()
s.add((x, y, z))
for _ in range(K):
    ans, (x, y, z) = heappop(Q)
    print((-ans))
    origin = [x, y, z]
    for i in range(3):
        xyz = origin[:]
        xyz[i] += 1
        x, y, z = xyz
        if x>=X or y>=Y or z>=Z: continue
        if not tuple(xyz) in s:
            heappush(Q, (-(Xs[x]+Ys[y]+Zs[z]), (x, y, z)))
            s.add((x, y, z))          

# Optimized solution
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)

X, Y, Z, K = mapint()
As = list(mapint())
Bs = list(mapint())
Cs = list(mapint())
As.sort(reverse=True)
Bs.sort(reverse=True)
Cs.sort(reverse=True)

from heapq import heappop, heappush
Q = []
heappush(Q, (-(As[0]+Bs[0]+Cs[0]), 0, 0, 0))
s = set()
for _ in range(K):
    v, a, b, c = heappop(Q)
    print((-v))
    if a+1<X and not (a+1, b, c) in s:
        s.add((a+1, b, c))
        heappush(Q, (-(As[a+1]+Bs[b]+Cs[c]), a+1, b, c))
    if b+1<Y and not (a, b+1, c) in s:
        s.add((a, b+1, c))
        heappush(Q, (-(As[a]+Bs[b+1]+Cs[c]), a, b+1, c))
    if c+1<Z and not (a, b, c+1) in s:
        s.add((a, b, c+1))
        heappush(Q, (-(As[a]+Bs[b]+Cs[c+1]), a, b, c+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()))

res = []
for a in A:
    for b in B:
        for c in C:
            res.append(a + b + c)

res.sort(reverse=True)
for i in range(K):
    print((res[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()))

res = []
for a in A:
    for b in B:
        res.append(a + b)

res.sort(reverse=True)

res2 = []
for v in res[:K]:
    for c in C:
        res2.append(v + c)

res2.sort(reverse=True)
for i in range(K):
    print((res2[i]))
# Original solution

from heapq import heappop, heappush

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)

pq = []
heappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))
appeared = set((0, 0, 0))

for _ in range(K):
    # Pop maximum value
    val, i, j, k = heappop(pq)
    print((-val))

    # Add next value
    if i + 1 < X and (i + 1, j, k) not in appeared:
        heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))
        appeared.add((i + 1, j, k))

    if j + 1 < Y and (i, j + 1, k) not in appeared:
        heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))
        appeared.add((i, j + 1, k))

    if k + 1 < Z and (i, j, k + 1) not in appeared:
        heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))
        appeared.add((i, j, k + 1))


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

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

res.sort(reverse=True)
for i in range(K):
    print((res[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()))

A = sorted(A, reverse = True)
B = sorted(B, reverse = True)
C = sorted(C, reverse = True)

ans = []

for i in range(min(K,X)):
  for j in range(min(K,Y)):
    for k in range(min(K,Z)):
      ans.append(A[i]+B[j]+C[k])
    
ans = sorted(ans, 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()))

A = sorted(A, reverse = True)
B = sorted(B, reverse = True)
C = sorted(C, reverse = True)

ans = []

for i in range(min(K,X)):
  for j in range(min(K//(i+1),Y)):
    for k in range(min(K//(i+1)//(j+1),Z)):
      ans.append(A[i]+B[j]+C[k])
    
ans = sorted(ans, reverse=True)

for i in range(K):
  print((ans[i]))
# Original solution
X,Y,Z,K = list(map(int,input().split()))
l_a = [int(x) for x in input().split()]
l_b = [int(x) for x in input().split()]
l_c = [int(x) for x in input().split()]
l_a.sort(reverse = True)  
l_b.sort(reverse = True)  
l_c.sort(reverse = True)
l_d = [a + b for a in l_a for b in l_b]
l_d.sort(reverse = True)
l_d[:3000]
l_e = [ab + c for ab in l_d for c in l_c]
l_e.sort(reverse = True)
 
for i in range(K):
    print((l_e[i]))

# Optimized solution
X,Y,Z,K = list(map(int,input().split()))
l_a = [int(x) for x in input().split()]
l_b = [int(x) for x in input().split()]
l_c = [int(x) for x in input().split()]
l_a.sort(reverse = True)  
l_b.sort(reverse = True)  
l_c.sort(reverse = True)
l_d = [a + b for a in l_a for b in l_b]
l_d.sort(reverse = True)
l_d = l_d[:3000]
l_e = [ab + c for ab in l_d for c in l_c]
l_e.sort(reverse = True)
 
for i in range(K):
    print((l_e[i]))
# Original solution
import sys
from itertools import product


X, Y, Z, K = map(int, input().split())
lst_A = sorted(map(int, input().split()), reverse=True)
lst_B = sorted(map(int, input().split()), reverse=True)
lst_C = sorted(map(int, input().split()), reverse=True)
lst_A_K = lst_A[:K]
lst_B_K = lst_B[:K]
lst_C_K = lst_C[:K]


lst_AB = sorted([a+b for a, b in product(lst_A_K, lst_B_K)], reverse=True)
lst_AB_K = lst_AB[:K]


lst_ABC = sorted([ab+c for ab, c in product(lst_AB_K, lst_C_K)], reverse=True)
lst_ABC_K = lst_ABC[:K]


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


# Optimized solution
import sys
from itertools import product


X, Y, Z, K = map(int, input().split())
lst_A = list(map(int, input().split()))
lst_B = list(map(int, input().split()))
lst_C = list(map(int, input().split()))
lst_A.sort(reverse=True)
lst_B.sort(reverse=True)
lst_C.sort(reverse=True)

# lst_A_K = lst_A[:K]
# lst_B_K = lst_B[:K]
lst_C_K = lst_C[:K]


lst_AB = sorted([a+b for a, b in product(lst_A, lst_B)], reverse=True)
lst_AB_K = lst_AB[:K]

lst_ABC = sorted([ab+c for ab, c in product(lst_AB_K, lst_C_K)], reverse=True)
lst_ABC_K = lst_ABC[:K]

print(*lst_ABC_K, sep="\n")
# Original solution
from itertools import product

X, Y, Z, K = list(map(int, input().split()))
lst_A = list(map(int, input().split()))
lst_B = list(map(int, input().split()))
lst_C = list(map(int, input().split()))
lst_A.sort(reverse=True)
lst_B.sort(reverse=True)
lst_C.sort(reverse=True)


lst_A_K = lst_A[:K]
lst_B_K = lst_B[:K]
lst_C_K = lst_C[:K]


lst_AB = sorted([a+b for a, b in product(lst_A_K, lst_B_K)], reverse=True)
lst_AB_K = lst_AB[:K]

lst_ABC = sorted([ab+c for ab, c in product(lst_AB_K, lst_C_K)], reverse=True)
lst_ABC_K = lst_ABC[:K]

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


# Optimized solution
import sys
from itertools import product

read = sys.stdin.readline
X, Y, Z, K = list(map(int, read().split()))
lst_A = list(map(int, read().split()))
lst_B = list(map(int, read().split()))
lst_C = list(map(int, read().split()))


lst_A.sort(reverse=True)
lst_B.sort(reverse=True)
lst_C.sort(reverse=True)
lst_C_K = lst_C[:K]


lst_AB = sorted([a+b for a, b in product(lst_A, lst_B)], reverse=True)
lst_AB_K = lst_AB[:K]

lst_ABC = sorted([ab+c for ab, c in product(lst_AB_K, lst_C_K)], reverse=True)
lst_ABC_K = lst_ABC[:K]

for i in range(K):
    print((lst_ABC_K[i]))
# Original solution
from itertools import product


X, Y, Z, K = map(int, input().split())
lst_A = list(map(int, input().split()))
lst_B = list(map(int, input().split()))
lst_C = list(map(int, input().split()))
lst_C = lst_C[:K]

lst_AB = [a + b for a, b in product(lst_A, lst_B)]
lst_AB.sort(reverse=True)
K_ = min(3000, X*Y*Z)
lst_ABC = [ab + c for ab, c in list(product(lst_AB[:K_], lst_C))]
lst_ABC.sort(reverse=True)


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


# Optimized solution
from itertools import product


X, Y, Z, K = map(int, input().split())
lst_A = list(map(int, input().split()))
lst_B = list(map(int, input().split()))
lst_C = list(map(int, input().split()))
lst_A.sort(reverse=True)
lst_B.sort(reverse=True)
lst_C.sort(reverse=True)

lst_C_K = lst_C[:K]


lst_AB = sorted([a+b for a, b in product(lst_A, lst_B)], reverse=True)
lst_AB_K = lst_AB[:K]

lst_ABC = sorted([ab+c for ab, c in product(lst_AB_K, lst_C_K)], reverse=True)
lst_ABC_K = lst_ABC[:K]

print(*lst_ABC_K, sep="\n")
# 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.sort(reverse=True)
ans = [ab + c for (ab, c) in list(itertools.product(AB[:min(3000, X*Y*Z)], C))]
ans.sort(reverse=True)

print(*ans[:K],sep='\n')


# Optimized solution
x,y,z,k = list(map(int,input().split()))
lisa = list(map(int,input().split()))
lisb = list(map(int,input().split()))
lisc = list(map(int,input().split()))
lisa.sort(reverse=True)
lisb.sort(reverse=True)
lisc.sort(reverse=True)
an = []
ans = []
for num in lisb:
    for nu in lisa:
        an.append(num+nu)
an.sort(reverse=True)
an = an[:min(3001,x*y*z+1)]
for num in lisc:
    for nu in an:
        ans.append(num+nu)
ans.sort(reverse=True)
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()))
ab=[]
for i in range(x):
    for j in range(y):
        ab+=[a[i]+b[j]]
ab.sort(key=lambda x: -x)
c.sort(key=lambda x: -x)
ans=[]
ct=[0]
ansc=[ab[0]+c[0]]
while (len(ans)<k):
    if(ct[-1]!=0 and len(ct)<z):
        ansc+=[ab[0]+c[len(ct)]]
        ct+=[0]
    ans+=[max(ansc)]
    tmp=ansc.index(max(ansc))
    if(ct[tmp]==len(ab)-1):
        ansc[tmp]=0
    else:
        ct[tmp]+=1
        ansc[tmp]=ab[ct[tmp]]+c[tmp]
for i in ans:
    print(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()))
ab=[]
for i in range(x):
    for j in range(y):
        ab.append(a[i]+b[j])
ab.sort(key=lambda x: -x)
c.sort(key=lambda x: -x)
ans=[]
ct=[0]
ansc=[ab[0]+c[0]]
while (len(ans)<k):
    if(ct[-1]!=0 and len(ct)<z):
        ansc+=[ab[0]+c[len(ct)]]
        ct+=[0]
    ans+=[max(ansc)]
    tmp=ansc.index(max(ansc))
    if(ct[tmp]==len(ab)-1):
        ansc[tmp]=0
    else:
        ct[tmp]+=1
        ansc[tmp]=ab[ct[tmp]]+c[tmp]
for i in ans:
    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()))
DD = []
A.sort()
B.sort()
C.sort()
for i in A:
    for j in B:
       DD.append(i+j)
DD.sort()
F = []
for i in DD[min(len(DD)-3010,0):]:
    for j in C:
        F.append(i+j)
F.sort()
for i in range(K):
    print((F[-1-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()))
DD = []
A.sort()
B.sort()
C.sort()
for i in A:
    for j in B:
       DD.append(i+j)
DD.sort()
F = []
for i in DD[max(len(DD)-3010,0):]:
    for j in C:
        F.append(i+j)
F.sort()
for i in range(K):
    print((F[-1-i]))
# Original solution
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(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)

now = [0, 0, 0]
que = [[A[0] + B[0] + C[0], 0, 0, 0]]
memory = [[A[0] + B[0] + C[0], 0, 0, 0]]
ans = []
while len(ans) < k:
  maxli = max(que, key = lambda x:x[0])
  ans.append(maxli[0])
  now = maxli[1:]
  que.remove(maxli)
  a = A[min(now[0] + 1, x - 1)]
  b = B[min(now[1] + 1, y - 1)]
  c = C[min(now[2] + 1, z - 1)]
  if [a + B[now[1]] + C[now[2]], min(now[0] + 1, x - 1), now[1], now[2]] not in memory:
    que.append([a + B[now[1]] + C[now[2]], min(now[0] + 1, x - 1), now[1], now[2]])
    memory.append([a + B[now[1]] + C[now[2]], min(now[0] + 1, x - 1), now[1], now[2]])
  if [A[now[0]] + b + C[now[2]], now[0], min(now[1] + 1, y - 1), now[2]] not in memory:
    que.append([A[now[0]] + b + C[now[2]], now[0], min(now[1] + 1, y - 1), now[2]])
    memory.append([A[now[0]] + b + C[now[2]], now[0], min(now[1] + 1, y - 1), now[2]])
  if [A[now[0]] + B[now[1]] + c, now[0], now[1], min(now[2] + 1, z - 1)] not in memory:
    que.append([A[now[0]] + B[now[1]] + c, now[0], now[1], min(now[2] + 1, z - 1)])
    memory.append([A[now[0]] + B[now[1]] + c, now[0], now[1], min(now[2] + 1, z - 1)])

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


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

now = [0, 0, 0]
que = [[A[0] + B[0] + C[0], 0, 0, 0]]
memory = [[0, 0, 0]]
ans = []
while len(ans) < k:
  maxli = max(que, key = lambda x:x[0])
  ans.append(maxli[0])
  now = maxli[1:]
  que.remove(maxli)
  a = A[min(now[0] + 1, x - 1)]
  b = B[min(now[1] + 1, y - 1)]
  c = C[min(now[2] + 1, z - 1)]
  if [min(now[0] + 1, x - 1), now[1], now[2]] not in memory:
    que.append([a + B[now[1]] + C[now[2]], min(now[0] + 1, x - 1), now[1], now[2]])
    memory.append([min(now[0] + 1, x - 1), now[1], now[2]])
  if [now[0], min(now[1] + 1, y - 1), now[2]] not in memory:
    que.append([A[now[0]] + b + C[now[2]], now[0], min(now[1] + 1, y - 1), now[2]])
    memory.append([now[0], min(now[1] + 1, y - 1), now[2]])
  if [now[0], now[1], min(now[2] + 1, z - 1)] not in memory:
    que.append([A[now[0]] + B[now[1]] + c, now[0], now[1], min(now[2] + 1, z - 1)])
    memory.append([now[0], now[1], min(now[2] + 1, z - 1)])

print(*ans, sep = "\n")
# Original solution
X, Y, Z, K = list(map(int, input().split()))

A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

import itertools
val_list = []

a_max = min(len(A_list), K)
b_max = min(len(B_list), K)
c_max = min(len(C_list), K)

A_list = sorted(A_list, reverse=True)
B_list = sorted(B_list, reverse=True)
C_list = sorted(C_list, reverse=True)
for a, b, c in itertools.product(A_list[:a_max], B_list[:b_max], C_list[:c_max]):
    val_list.append(a + b + c)
    
val_list = sorted(val_list, reverse=True)
for i in range(K):
    print((val_list[i]))
    


            


# Optimized solution
X, Y, Z, K = list(map(int, input().split()))

A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))


import itertools
val_list = []


A_list = sorted(A_list, reverse=True)
B_list = sorted(B_list, reverse=True)
C_list = sorted(C_list, reverse=True)

#print(A_list)
#print(B_list)
#print(C_list)

for a, b, c in itertools.product(list(range(len(A_list))), list(range(len(B_list))), list(range(len(C_list)))):
    if (a+1) * (b+1) * (c+1) > K:
        continue
        
    val_list.append(A_list[a] + B_list[b] + C_list[c])

val_list = sorted(val_list, reverse=True)
for i in range(K):
    print((val_list[i]))
# Original solution
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)

x = 0
y = 0
z = 0
cakes = []
for x, a in enumerate(A):
    for y, b in enumerate(B):
        for z, c in enumerate(C):
            
            if (x+1)*(y+1)*(z+1) > k:
                break
                
            cakes.append(a+b+c)
    
cakes.sort(reverse=True)      
for cake in cakes[:k]:
    print(cake)

# Optimized solution
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)

x = 0
y = 0
z = 0
cakes = []
for x, a in enumerate(A):
    if x+1 > k: break
        
    for y, b in enumerate(B):
        if (x+1)*(y+1) > k: break
            
        for z, c in enumerate(C):
            if (x+1)*(y+1)*(z+1) > k: break
                
            cakes.append(a+b+c)
    
cakes.sort(reverse=True)      
for cake in cakes[:k]:
    print(cake)
# Original solution
x,y,z,N =(int(i) for i in 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()]

sa=sorted(a,reverse=True)
sb=sorted(b,reverse=True)
sc=sorted(c,reverse=True)
l=[]#端点情報
n=0
i=0
j=0
k=0

while n<N:
  print((sa[i]+sb[j]+sc[k]))
  l.append([i,j,k])
  maxl=0
  maxijk=[len(sa)-1,len(sb)-1,len(sc)-1]
  for w in l:
    if w[0]<len(sa)-1:
      if not ([w[0]+1,w[1],w[2]] in l):
        if maxl<=sa[w[0]+1]+sb[w[1]]+sc[w[2]]:
          maxl=sa[w[0]+1]+sb[w[1]]+sc[w[2]]
          maxijk=[w[0]+1,w[1],w[2]]
    if w[1]<len(sb)-1:
      if not([w[0],w[1]+1,w[2]] in l):
        if maxl<=sa[w[0]]+sb[w[1]+1]+sc[w[2]]:
          maxl=sa[w[0]]+sb[w[1]+1]+sc[w[2]]
          maxijk=[w[0],w[1]+1,w[2]]
    if w[2]<len(sc)-1:
      if not([w[0],w[1],w[2]+1] in l):
        if maxl<=sa[w[0]]+sb[w[1]]+sc[w[2]+1]:
          maxl=sa[w[0]]+sb[w[1]]+sc[w[2]+1]
          maxijk=[w[0],w[1],w[2]+1]
    i=maxijk[0]
  j=maxijk[1]
  k=maxijk[2]
  n+=1

# Optimized solution
#解答を見た後


x,y,z,N =(int(i) for i in 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()]

sa=sorted(a,reverse=True)
sb=sorted(b,reverse=True)
sc=sorted(c,reverse=True)
answer=[]

for i in range(len(sa)):
  for j in range(len(sb)):
    if (i+1)*(j+1)>N:break
    for k in range(len(sb)):
      if (i+1)*(j+1)*(k+1)>N:break 
      answer.append(sa[i]+sb[j]+sc[k])
answer=sorted(answer,reverse=True)
for i in range(0,N):
  print((answer[i]))