CodeEff/ECCO huggingface dataset:
# Original solution
# -*- coding:utf-8 -*-


def solve():
    """ TLE """
    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 x in range(X):
        for y in range(Y):
            ab = A[x] + B[y]
            for z in range(Z):
                abc = ab + C[z]
                if len(ans) < K-1:
                    ans.append(abc)
                    continue
                elif len(ans) == K-1:
                    ans.append(abc)
                    ans.sort(reverse=True)
                    continue
                
                if abc > ans[-1]:
                    ans[-1] = abc
                    ans.sort(reverse=True)
                    continue

    
    for i in range(0, K):
        print((ans[i]))


if __name__ == "__main__":
    solve()


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

def solve():
    """ TLE """
    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 = []

    for x in range(X):
        for y in range(Y):
            ab = A[x] + B[y]
            for z in range(Z):
                if (x+1)*(y+1)*(z+1) > K:
                    break

                ans.append(ab + C[z])

    ans.sort(reverse=True)              
    
    for i in range(0, K):
        print((ans[i]))


if __name__ == "__main__":
    solve()
# Original solution
import sys

x, y, z, k = list(map(int, sys.stdin.readline().split()))

xlist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(x, k)]
ylist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(y, k)]
zlist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(z, k)]


anslist = [0]
for i in range(min(x, k)):
    for j in range(min(y, k)):
        for l in range(min(z, k)):
            if (i+1)*(j+1)*(l+1) <= k:
                anslist.append(xlist[i]+ylist[j]+zlist[l])

anslist = sorted(anslist, reverse=True)
for i in range(k):
    print((anslist[i]))


# Optimized solution
import sys

x, y, z, k = list(map(int, sys.stdin.readline().split()))

xlist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(x, k)]
ylist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(y, k)]
zlist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(z, k)]


anslist = [0]
for i in range(min(x, k)):
    for j in range(min(y, k)):
        for l in range(min(z, k)):
            if (i+1)*(j+1)*(l+1) <= k:
                anslist.append(xlist[i] + ylist[j] + zlist[l])
            else:
                break

anslist = sorted(anslist, reverse=True)
for i in range(k):
    print((anslist[i]))
# Original solution
from bisect import bisect_left
from heapq import heappush, heappop

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)

# x以上のものがK個あるならOK
def f(x):
    cnt = 0
    for i in A:
        for j in B:
            for k in C:
                if i+j+k<x:break
                cnt += 1
                if cnt>=K:
                    return True
    return False

def get_boarder():
    l, r = 0, A[0]+B[0]+C[0]
    while r-l>1:
        m = (l+r)//2
        if f(m):
            l = m
        else:
            r = m
    return l

s = []
for i in B:
    for j in C:
        s.append(i+j)
s.sort()
A.sort()
boarder = get_boarder()
q = []

for i in A:
    if boarder-i<0:continue
    pos = bisect_left(s, boarder-i)
    for j in s[pos:]:
        heappush(q, -(i+j))

for _ in range(K):
    print((-heappop(q)))

# Optimized solution
from heapq import heappush, heappop

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)

# x以上のものがK個あるならOK
def f(x):
    cnt = 0
    for i in A:
        for j in B:
            for k in C:
                if i+j+k<x:break
                cnt += 1
                if cnt>=K:
                    return True
    return False

def get_boarder():
    l, r = 0, A[0]+B[0]+C[0]
    while r-l>1:
        m = (l+r)//2
        if f(m):
            l = m
        else:
            r = m
    return l

boarder = get_boarder()
q = []
for i in A:
    for j in B:
        for k in C:
            if i+j+k<boarder:break
            heappush(q, -(i+j+k))

for _ in range(K):
    print((-heappop(q)))
# Original solution
from heapq import heappop, heappush
from itertools import product

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)

D = [i+j for j in C for i in B]
D.sort(reverse=True)

q = []
for i, j in product(A, D):
    heappush(q, -(i+j))

for _ in range(K):
    print((-heappop(q)))

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

# Bi+Cjの和を求め、降順にソートしておく(Dkとします)
D = [i+j for j in C for i in B]
D.sort(reverse=True)

# Ai+Bj+Ckの大きい順からK個を構成する要素としては、Aiの大きい順からK個とDkの大きい順からK個しか登場しないので
q = []
for i in A[:K]:
    for j in D[:K]:
        heappush(q, -(i+j))

for _ in range(K):
    print((-heappop(q)))
# Original solution
x,y,z,k=list(map(int,input().split()))
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
c=[int(x) for x in input().split()]

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

s=list()

for l in range(x):
    for m in range(y):
      for n in range(z):
        if l*m*n>k:
           break
        s.append(a[l]+b[m]+c[n])
 
s.sort(reverse=True)
for i in range(k):
  print((s[i]))


# Optimized solution
x,y,z,k=list(map(int,input().split()))
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
c=[int(x) for x in input().split()]

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

s=list()

for l in range(x):
  if l>k:
    break 
  for m in range(y):
    if l*m>k:
      break
    for n in range(z):
      if l*m*n>k:
        break
      s.append(a[l]+b[m]+c[n])
 
s.sort(reverse=True)
for i in range(k):
  print((s[i]))
# Original solution
import sys,queue,math,copy,itertools,bisect,collections
LI = lambda : [int(x) for x in sys.stdin.readline().split()]

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

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

h = A[0] + B[0] + C[0]
l = 0
while h > l+1:
    m = (h+l) // 2

    num = 0
    for a in A:
        j = len(C) - 1
        for i in B:
            while i + C[j] < m - a:
                j -= 1
                if j < 0: break
            else:
                num += j + 1
                continue
            break
    if num > K:
        l = m
    else:
        h = m

ans = []
cnt = 0
for a in A:
    j = len(C) - 1
    last_cnt = cnt
    for i in B:

        while i + C[j] <= l - a:
            j -= 1
            if j < 0: break
        else:
            for k in range(j+1):
                ans.append(a+i+C[k])
                cnt += 1
            continue
        break
ans.sort(reverse=True)
for _ in range(K-len(ans)):
    ans.append(l)
print (*ans[:K],sep='\n')



# Optimized solution
import sys,queue,math,copy,itertools,bisect,collections
LI = lambda : [int(x) for x in sys.stdin.readline().split()]

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

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

h = A[0] + B[0] + C[0]
l = 0
while h > l+1:
    m = (h+l) // 2

    num = 0
    for a in A:
        j = len(C) - 1
        for i in B:
            while i + C[j] < m - a:
                j -= 1
                if j < 0: break
            else:
                num += j + 1
                continue
            break
    if num > K:
        l = m
    else:
        h = m

ans = []
for a in A:
    j = len(C) - 1
    for i in B:

        while i + C[j] <= l - a:
            j -= 1
            if j < 0: break
        else:
            for k in range(j+1):
                ans.append(a+i+C[k])
            continue
        break

ans.sort(reverse=True)
for _ in range(K-len(ans)):
    ans.append(l)
print(*ans[:K], sep='\n')
# Original solution
x, y, z, k = list(map(int, input().split()))
c_s = list(map(int, input().split()))
b_s = list(map(int, input().split()))
a_s = list(map(int, input().split()))
a_s.sort(reverse=True)
b_s.sort(reverse=True)
c_s.sort(reverse=True)

d = {}
abcs = [0]
j = -1

for a in a_s:
    for b in b_s:
        for c in c_s:
            abc = a + b + c
            if j >= k and abcs[k-1] >= abc:
                break
            if abcs[0] == 0:
                abcs[0] = abc
            else:
                for i in reversed(list(range(len(abcs)))):
                    if abcs[i] >= abc:
                        abcs.insert(i+1, abc)
                        break
                if j >= k:
                    abcs.pop(-1)
            j += 1
for i in range(k):
    print((abcs[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 ai in a:
  for bi in b:
    ab.append(ai + bi)
ab.sort(reverse = True)

abc = []

for abi in ab[:k]:
  for ci in c:
    abc.append(abi + ci)
abc.sort(reverse = True)

for abci in abc[:k]:
  print(abci)
# 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()))

l = []

for i in a:
    for j in b:
        for k in c:
            l.append(i + j + k)
l.sort(reverse = True)

for i in range(K):
    print((l[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()))
l = []

for i in range(X):
    for j in range(Y):
        l.append(a[i] + b[j])
l.sort(reverse = True)
l = l[:K]

L = []
for i in range(len(l)):
    for j in range(Z):
        L.append(l[i] + c[j])

L.sort(reverse = True)
for i in range(K):
    print((L[i]))
# Original solution
X, Y, Z, K = [int(i) for i in input().split()]
ABCList = [sorted([int(i) for i in input().split()], reverse=True) for _ in range(3)]

ABSum = sorted([i + j for i in ABCList[0] for j in ABCList[1]], reverse=True)[:K]
for ans in sorted([i + j for i in ABSum for j in ABCList[2]], reverse=True)[:K]:
    print(ans)


# Optimized solution
X, Y, Z, K = [int(i) for i in input().split()]
ABCList = [sorted([int(i) for i in input().split()], reverse=True) for _ in range(3)]

ansList = []
for i, A in enumerate(ABCList[0]):
    for j, B in enumerate(ABCList[1]):
        for k, C in enumerate(ABCList[2]):
            if (i + 1) * (j + 1) * (k + 1) <= K:
                ansList.append(A + B + C)
            else:
                break

for ans in sorted(ansList, reverse=True)[:K]:
    print(ans)
# Original solution
import bisect

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)
nums = []

for a in A:
    for b in B:
        for c in C:
            n = a + b + c
            idx = bisect.bisect_right(nums, n)
            if idx == 0 and len(nums) > K:
                break
            else:
                nums.insert(idx, n)
                if len(nums) > K:
                    nums.pop(0)
        if a + b + C[0] < nums[0]:
            break
    if a + B[0] + C[0] < nums[0]:
        break

for n in nums[::-1]:
    print(n)

# 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 = sorted([a+b for a in A for b in B], reverse=True)

E = E[:K]
nums = sorted([e+c for e in E for c in C], reverse=True)

for n in nums[:K]:
    print(n)
# 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()))


K=min(K,3000)

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

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

for k in range(K):
	print((ABC[k]))


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

K=min(K,3000)

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

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

for k in range(K):
	print((ABC[k]))
# Original solution
x,y,z,k=list(map(int,input().split()))
a,b,c=[list(map(int,input().split())) for i in range(3)]
l=[i+j for i in a for j in b]
l.sort(reverse=True)
maxl=[i+j for i in l[:k] for j in c]
maxl.sort(reverse=True)
for a in maxl[:k]:
    print(a)

# Optimized solution
x,y,z,k=list(map(int,input().split()))
a,b,c=[sorted(list(map(int,input().split())),reverse=True) for i in range(3)]
L=[]
for i in range(x):
    for j in range(y):
        if (i+1)*(j+1)>k:
            break
        for m in range(z):
            if (i+1)*(j+1)*(m+1)>k:
                break
            else:
                L.append(a[i]+b[j]+c[m])
for i in sorted(L,reverse=True)[:k]:
    print(i)
# Original solution
import heapq


X,Y,Z,K = list(map(int,input().split()))
Alist = list( map(int, input().split()))
Blist = list(map(int, input().split()))
Clist = list( map(int, input().split()))

sum =[]
heapq.heapify(sum)

for i in range(0,X):
    for j in range(0,Y):
        for k in range(0,Z):
            heapq.heappush(sum,(Alist[i]+Blist[j]+Clist[k])*(-1))

for i in range(0,K):
    print((-1*heapq.heappop(sum)))

# Optimized solution
import heapq


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

Alist = list( map(int, input().split()))
Blist = list(map(int, input().split()))
Clist = list( map(int, input().split()))
Alist.sort(reverse=True)
Blist.sort(reverse=True)
Clist.sort(reverse=True)

sum =[]
heapq.heapify(sum)

arg_hash = {}
heapq.heappush(sum,((Alist[0]+Blist[0]+Clist[0])*(-1),(0,0,0)))

for i in range(0,K):
    ans,(a,b,c) = heapq.heappop(sum)
    print((-ans))

    arg_a = a+1,b,c
    arg_b = a,b+1,c
    arg_c = a,b,c+1

    if a < X-1 and arg_a not in arg_hash:
        heapq.heappush(sum,((Alist[a+1]+Blist[b]+Clist[c])*(-1),arg_a))
        arg_hash[arg_a]=1
    if b < Y-1 and arg_b not in arg_hash:
        heapq.heappush(sum,((Alist[a]+Blist[b+1]+Clist[c])*(-1),arg_b))
        arg_hash[arg_b]=1
    if c < Z - 1 and arg_c not in arg_hash:
        heapq.heappush(sum, ((Alist[a] + Blist[b] + Clist[c+1]) * (-1), arg_c))
        arg_hash[arg_c] = 1
# Original solution
from heapq import heappush, heappop

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)

q = []
x = y = z = 0
heappush(q, (-(A[x] + B[y] + C[z]), (x, y, z)))
done = set((0, 0, 0))
ans = []
for _ in range(K):
    val, (x, y, z) = heappop(q)
    ans.append(-val)
    for i, j, k in [(1, 0, 0), (0, 1, 0), (0, 0, 1)]:
        nx = x + i; ny = y + j; nz = z + k
        if nx < X and ny < Y and nz < Z and (nx, ny, nz) not in done:
            heappush(q, (-(A[nx] + B[ny] + C[nz]), (nx, ny, nz)))
            done.add((nx, ny, nz))

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)

ans = []
for x in range(X):
    for y in range(Y):
        for z in range(Z):
            if (x + 1) * (y + 1) * (z + 1) <= K:
                ans.append(A[x] + B[y] + C[z])
            else:
                break

ans.sort(reverse=True)
print(*ans[:K], sep='\n')
# Original solution
# solution 2
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)
L = []
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i+1)*(j+1)*(k+1) <= K:
                L.append(A[i]+B[j]+C[k])
            else:
                break
L.sort(reverse=True)
for l in range(K):
    print((L[l]))

# Optimized solution
# solution 2
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)
L = []
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
            else:
                L.append(A[i] + B[j] + C[k])
L.sort(reverse=True)
for l in range(K):
    print((L[l]))
# Original solution
# solution 3
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)
Q = []
s = []
heapq.heappush(Q, (-A[0]-B[0]-C[0], 0, 0, 0))
for n in range(K):
    q, i, j, k = heapq.heappop(Q)
    print((-q))
    if i < X-1 and [i+1, j, k] not in s:
            heapq.heappush(Q, (- A[i+1] - B[j] - C[k], i+1, j, k))
            s.append([i + 1, j, k])
    if j < Y-1 and [i, j+1, k] not in s:
            heapq.heappush(Q, (- A[i] - B[j+1] - C[k], i, j+1, k))
            s.append([i, j + 1, k])
    if k < Z-1 and [i, j, k+1] not in s:
            heapq.heappush(Q, (- A[i] - B[j] - C[k+1], i, j, k+1))
            s.append([i, j, k + 1])

# Optimized solution
# solution 3
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)
Q = []
s = set()
heapq.heappush(Q, (-A[0]-B[0]-C[0], 0, 0, 0))
for n in range(K):
    q, i, j, k = heapq.heappop(Q)
    print((-q))
    if i < X-1 and (i+1, j, k) not in s:
            heapq.heappush(Q, (- A[i+1] - B[j] - C[k], i+1, j, k))
            s.add((i + 1, j, k))
    if j < Y-1 and (i, j+1, k) not in s:
            heapq.heappush(Q, (- A[i] - B[j+1] - C[k], i, j+1, k))
            s.add((i, j + 1, k))
    if k < Z-1 and (i, j, k+1) not in s:
            heapq.heappush(Q, (- A[i] - B[j] - C[k+1], i, j, k+1))
            s.add((i, j, k + 1))
# 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)

d = []
for i in range(len(a)):
    for j in range(len(b)):
        d.append(a[i]+b[j])

tmp = sorted(d, reverse=True)
if len(tmp) < k:
    use_tmp = tmp
else:
    use_tmp = tmp[0:k]
    
ans = []
for i in range(len(use_tmp)):
    for j in range(len(c)):
        ans.append(use_tmp[i]+c[j])
final_ans = sorted(ans, reverse=True)

for i in range(k):
    print((final_ans[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)

sumAB = sorted([ai + bi for ai in a for bi in b],reverse=True)[:k]
final_ans = sorted([ci + abi for ci in c for abi in sumAB],reverse = True)[:k]

for i in range(k):
    print((final_ans[i]))
# Original solution
from heapq import heapify, heappush, heappop, heapreplace
from collections import deque
import sys
input = sys.stdin.readline
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)
D = deque([(0,0,0)])
F = set()
H = [0]
heapify(H)
k = 1
while D:
    p = D.popleft()
    if p in F:
        continue
    F.add(p)
    x, y, z = p
    d = A[x] + B[y] + C[z]
    if k < K:
        heappush(H, d)
        k += 1
    elif H[0] > d:
        continue
    else:
        heapreplace(H, d)
    if x < X - 1: D.append((x + 1, y, z))
    if y < Y - 1: D.append((x, y + 1, z))
    if z < Z - 1: D.append((x, y, z + 1))

print(*sorted(H, reverse=True), sep="\n")


# Optimized solution
from heapq import heapify, heappush, heappop, heapreplace
import sys
input = sys.stdin.readline
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)
D = [(-(A[0] + B[0] + C[0]), 0, 0, 0)]
heapify(D)
F = set()
for _ in range(K):
    p = heappop(D)
    d, x, y, z = p
    print((-d))
    if x < X - 1:
        p = (-(A[x + 1] + B[y] + C[z]), x + 1, y, z)
        if p not in F:
            heappush(D, p)
            F.add(p)
    if y < Y - 1:
        p = (-(A[x] + B[y + 1] + C[z]), x, y + 1, z)
        if p not in F:
            heappush(D, p)
            F.add(p)
    if z < Z - 1:
        p = (-(A[x] + B[y] + C[z + 1]), x, y, z + 1)
        if p not in F:
            heappush(D, p)
            F.add(p)
# Original solution
X,Y,Z,K=list(map(int,input().split()))
A=[int(x) for x in input().split()]
B=[int(x) for x in input().split()]
C=[int(x) for x in input().split()]
A.sort(reverse =True)
B.sort(reverse =True)
C.sort(reverse =True)
answer=[]
for p in range(min(X,K)):
  for q in range(min(Y,K)):
    for r in range(min(Z,K)):
      answer +=[A[p]+B[q]+C[r]]
answer.sort()
for i in range(K):
  print((answer[-i-1]))

# Optimized solution
X,Y,Z,K=list(map(int,input().split()))
A=[int(x) for x in input().split()]
B=[int(x) for x in input().split()]
C=[int(x) for x in input().split()]
A.sort(reverse =True)
B.sort(reverse =True)
C.sort(reverse =True)
answer=[]
for p in range(min(X,K)):
  for q in range(min(Y,K)):
    if p*q>K:
      break
    for r in range(min(Z,K)):
      if p*q*r>K:
        break
      answer +=[A[p]+B[q]+C[r]]
answer.sort()
for i in range(K):
  print((answer[-i-1]))
# Original solution
#!/usr/bin/env python
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)
D = []
E = []
for b in B:
    for c in C:
        D.append(b+c)
D.sort(reverse=True)
n = 0
for a in A:
    for d in D:
       E.append(a+d)
E.sort(reverse=True)
for e in E[:k]:
    print(e)

# Optimized solution
#!/usr/bin/env python
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)
D = []
E = []
for b in B:
    for c in C:
        D.append(b+c)
D.sort(reverse=True)
n = 0
for a in A:
    for d in D[:k]:
       E.append(a+d)
E.sort(reverse=True)
for e in E[:k]:
    print(e)