CodeEff/ECCO huggingface dataset:
# Original solution
def MergeSort(arr):
    if len(arr) <= 1:
        return arr
    mid = len(arr) // 2
    left = arr[:mid]
    right = arr[mid:]
    left = MergeSort(left)
    right = MergeSort(right)
    return MergeArray(left, right)

def MergeArray(left, right):
    merged = []
    li, ri = 0, 0
    while li < len(left) and ri < len(right):
        if left[li] > right[ri]:
            merged.append(left[li])
            li += 1
        else:
            merged.append(right[ri])
            ri += 1
    if li < len(left):
        merged.extend(left[li:])
    elif ri < len(right):
        merged.extend(right[ri:])
    return merged

def solve():
    X, Y, Z, K = [int(_) for _ in input().split()]
    A = [int(_) for _ in input().split()]
    B = [int(_) for _ in input().split()]
    C = [int(_) for _ in input().split()]
    A = MergeSort(A)[:K]
    B = MergeSort(B)[:K]
    C = MergeSort(C)[:K]
    lB = len(B)
    lC = len(C)
    sumAB = []
    for i in range(lB):
        tmpA = [ele + B[i] for ele in A]
        sumAB = MergeArray(sumAB, tmpA)
    sumABC = []
    for i in range(lC):
        tmpAB = [ele + C[i] for ele in sumAB]
        sumABC = MergeArray(sumABC, tmpAB)
    for i in range(K):
        print(sumABC[i])

if __name__ == '__main__':
    solve()


# Optimized solution
def MergeSort(arr):
    if len(arr) <= 1:
        return arr
    mid = len(arr) // 2
    left = arr[:mid]
    right = arr[mid:]
    left = MergeSort(left)
    right = MergeSort(right)
    return MergeArray(left, right)

def MergeArray(left, right):
    merged = []
    li, ri = 0, 0
    while li < len(left) and ri < len(right):
        if left[li] > right[ri]:
            merged.append(left[li])
            li += 1
        else:
            merged.append(right[ri])
            ri += 1
    if li < len(left):
        merged.extend(left[li:])
    elif ri < len(right):
        merged.extend(right[ri:])
    return merged

def solve():
    X, Y, Z, K = [int(_) for _ in input().split()]
    A = [int(_) for _ in input().split()]
    B = [int(_) for _ in input().split()]
    C = [int(_) for _ in input().split()]
    A = MergeSort(A)[:K]
    B = MergeSort(B)[:K]
    C = MergeSort(C)[:K]
    lB = len(B)
    lC = len(C)
    sumAB = []
    for i in range(lB):
        tmpA = [ele + B[i] for ele in A]
        sumAB = MergeArray(sumAB, tmpA)[:K]
    sumABC = []
    for i in range(lC):
        tmpAB = [ele + C[i] for ele in sumAB]
        sumABC = MergeArray(sumABC, tmpAB)[:K]
    for i in range(K):
        print(sumABC[i])

if __name__ == '__main__':
    solve()
# Original solution
def get_input():
    X, Y, Z, K = [int(_) for _ in input().split()]
    A = [int(_) for _ in input().split()]
    B = [int(_) for _ in input().split()]
    C = [int(_) for _ in input().split()]
    return X, Y, Z, K, A, B, C

def solve():
    X, Y, Z, K, A, B, C = get_input()
    A = MergeSort(A)[:K]
    B = MergeSort(B)[:K]
    C = MergeSort(C)[:K]
    lB = len(B)
    lC = len(C)
    sumAB = []
    for i in range(lB):
        tmpA = [ele + B[i] for ele in A]
        sumAB = MergeArray(sumAB, tmpA)[:K]
    sumABC = []
    for i in range(lC):
        tmpAB = [ele + C[i] for ele in sumAB]
        sumABC = MergeArray(sumABC, tmpAB)[:K]
    for i in range(K):
        print(sumABC[i])

def solve2():
    X, Y, Z, K, A, B, C = get_input()
    A.sort(reverse = True)
    B.sort(reverse = True)
    C.sort(reverse = True)
    sumABC = []
    for i in range(X):
        for j in range(Y):
            for k in range(Z):
                if (i + 1) * (j + 1) * (k + 1) <= K:
                    sumABC.append(A[i] + B[j] + C[k])
    sumABC.sort(reverse = True)
    for i in range(K):
        print(sumABC[i])

if __name__ == '__main__':
    solve2()


# Optimized solution
def get_input():
    X, Y, Z, K = [int(_) for _ in input().split()]
    A = [int(_) for _ in input().split()]
    B = [int(_) for _ in input().split()]
    C = [int(_) for _ in input().split()]
    return X, Y, Z, K, A, B, C

def AddToQueue(_ele, _queue, _ijk_set, K):
    if len(_queue) == 0:
        _queue.append(_ele)
    else:
        cnt = 0
        while cnt < len(_queue) and _queue[cnt][0] >= _ele[0]:
            cnt += 1
        ijk = (_ele[1], _ele[2], _ele[3])
        if not (ijk in _ijk_set):
            _queue.insert(cnt, _ele)
            _ijk_set.add(ijk)
            _queue = _queue[:K]

def solve3():
    X, Y, Z, K, A, B, C = get_input()
    A.sort(reverse = True)
    B.sort(reverse = True)
    C.sort(reverse = True)
    ijk_set = set()
    queue = [(A[0] + B[0] + C[0], 0, 0, 0)]
    ijk_set.add((0, 0, 0))
    for cnt in range(K):
        ele, i, j, k = queue.pop(0)
        print(ele)
        if i + 1 < X:
            AddToQueue((A[i+1] + B[j] + C[k], i+1, j, k), queue, ijk_set, K)
        if j + 1 < Y:
            AddToQueue((A[i] + B[j+1] + C[k], i, j+1, k), queue, ijk_set, K)
        if k + 1 < Z:
            AddToQueue((A[i] + B[j] + C[k+1], i, j, k+1), queue, ijk_set, K)

if __name__ == '__main__':
    solve3()
# Original solution
def get_input():
    X, Y, Z, K = [int(_) for _ in input().split()]
    A = [int(_) for _ in input().split()]
    B = [int(_) for _ in input().split()]
    C = [int(_) for _ in input().split()]
    return X, Y, Z, K, A, B, C

def AddToQueue(_ele, _queue, _ijk_set, K):
    if len(_queue) == 0:
        _queue.append(_ele)
    else:
        cnt = 0
        while cnt < len(_queue) and _queue[cnt][0] >= _ele[0]:
            cnt += 1
        ijk = (_ele[1], _ele[2], _ele[3])
        if not (ijk in _ijk_set):
            _queue.insert(cnt, _ele)
            _ijk_set.add(ijk)
            _queue = _queue[:K]

def solve3():
    X, Y, Z, K, A, B, C = get_input()
    A.sort(reverse = True)
    B.sort(reverse = True)
    C.sort(reverse = True)
    ijk_set = set()
    queue = [(A[0] + B[0] + C[0], 0, 0, 0)]
    ijk_set.add((0, 0, 0))
    for cnt in range(K):
        ele, i, j, k = queue.pop(0)
        print(ele)
        if i + 1 < X:
            AddToQueue((A[i+1] + B[j] + C[k], i+1, j, k), queue, ijk_set, K)
        if j + 1 < Y:
            AddToQueue((A[i] + B[j+1] + C[k], i, j+1, k), queue, ijk_set, K)
        if k + 1 < Z:
            AddToQueue((A[i] + B[j] + C[k+1], i, j, k+1), queue, ijk_set, K)

if __name__ == '__main__':
    solve3()


# Optimized solution
def get_input():
    X, Y, Z, K = [int(_) for _ in input().split()]
    A = [int(_) for _ in input().split()]
    B = [int(_) for _ in input().split()]
    C = [int(_) for _ in input().split()]
    return X, Y, Z, K, A, B, C

def solve2():
    X, Y, Z, K, A, B, C = get_input()
    A.sort(reverse = True)
    B.sort(reverse = True)
    C.sort(reverse = True)
    sumABC = []
    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
                sumABC.append(A[i] + B[j] + C[k])
    sumABC.sort(reverse = True)
    for i in range(K):
        print(sumABC[i])

if __name__ == '__main__':
    solve2()
# Original solution
k = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
z = [int(i) for i in input().split()]

x.sort()
y.sort()
z.sort()

e = []

for i in x:
  for j in y:
    e.append(i+j)

e.sort()

f = []

for i in e:
  for j in z:
    f.append(i+j)

f.sort()
f.reverse()

for i in range(k[3]):
  print((f[i]))


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

l1=sorted([i+j for i in a for j in b],reverse=True)[:k]
l2=sorted([i+j for i in l1 for j in c],reverse=True)[:k]
for i in l2:
  print(i)


# Optimized solution
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)
l1=sorted([i+j for i in a for j in b],reverse=True)[:k]
l2=sorted([i+j for i in l1 for j in c],reverse=True)[:k]
for i in l2:
  print(i)
# Original solution
X, Y, Z, K = list(map(int, input().split()))

A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)

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

AB.sort(reverse=True)

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

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


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

A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)

ABC = []
for a in range(X):
    for b in range(Y):
        if (a + 1) * (b + 1) > K:
            break
        for c in range(Z):
            if (a + 1) * (b + 1) * (c + 1) > K:
                break
            ABC.append(A[a] + B[b] + C[c])

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

Al = sorted(A,reverse=True)[:K]
Bl = sorted(B,reverse=True)[:K]
Cl = sorted(C,reverse=True)[:K]

result = []
for a in Al:
    for b in Bl:
        for c in Cl:
            result.append(a+b+c)

result.sort(reverse=True)

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

Al = sorted(A,reverse=True)[:K]
Bl = sorted(B,reverse=True)[:K]
Cl = sorted(C,reverse=True)[:K]

ABl = []
for a in Al:
    for b in Bl:
        ABl.append(a+b)

result = []
ABl = sorted(ABl,reverse=True)[:K]
for ab in ABl:
    for c in Cl:
        result.append(ab+c)

result.sort(reverse=True)

for i in range(K):
    print((result[i]))
# Original solution
X,Y,Z,K = list(map(int,input().split()))
list_a = list(map(int,input().split()))
list_b = list(map(int,input().split()))
list_c = list(map(int,input().split()))

list_a.sort(reverse=True)
list_b.sort(reverse=True)
list_c.sort(reverse=True)

list = []

for la in list_a:
    for lb in list_b:
        list.append([la,lb,la+lb])

list.sort(key=lambda x:x[2],reverse=True)

list2 = []

for a,b,n in list:
    for lc in list_c:
        list2.append(n+lc)

list2.sort(reverse=True)

cnt = 0

for i in list2:
    print(i)
    cnt += 1
    if cnt == K:
        exit()

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

list_a = list(map(int,input().split()))
list_b = list(map(int,input().split()))
list_c = list(map(int,input().split()))

list_a.sort(reverse=True)
list_b.sort(reverse=True)
list_c.sort(reverse=True)

sum_ = []
for a in range(X):
    for b in range(Y):
        for c in range(Z):
            if (a+1)*(b+1)*(c+1) > K:
                break
            sum_.append(list_a[a]+list_b[b]+list_c[c])

sum_.sort(reverse=True)

for i in range(K):
    print((sum_[i]))
# Original solution
import itertools
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()]

D = []
for a, b in itertools.product(A, B):
    d = a + b
    D.append(d)
D.sort(reverse = True)

E = []
for c, d in itertools.product(C, D[:K]):
    e = c + d
    E.append(e)
    
E.sort(reverse = True)
for e in E[:K]:
    print(e)

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

D = []
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
            D.append(A[i] + B[j] + C[k])
            #print(A[i] + B[j] + C[k], i, j, k)
            
D.sort(reverse = True)
for d in D[:K]:
    print(d)
# Original solution
x,y,z,k=list(map(int,input().split()))
a=sorted([int(i) for i in input().split()],reverse=True)
b=sorted([int(i) for i in input().split()],reverse=True)
c=sorted([int(i) for i in input().split()],reverse=True)
ab=[a[i]+b[j] for j in range(y) for i in range(x)]
ab.sort(reverse=True)
ab=ab[:k]
l=len(ab)
abc=[ab[i]+c[j] for j in range(z) for i in range(l)]
abc.sort(reverse=True)
for i in range(k):
    print((abc[i]))


# 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()
b.sort()
c.sort()
ab=[a[i]+b[j] for j in range(y) for i in range(x)]
ab.sort(reverse=True)
ab=ab[:k]
l=len(ab)
abc=[ab[i]+c[j] for j in range(z) for i in range(l)]
abc.sort(reverse=True)
for i in range(k):
    print((abc[i]))
# Original solution
#AC済み
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()
b.sort()
c.sort()
ab=[-a[i]-b[j] for j in range(y) for i in range(x)]
ab.sort()
ab=ab[:k]
l=len(ab)
abc=[ab[i]-c[j] for j in range(z) for i in range(l)]
abc.sort()
for i in range(k):
    print((-abc[i]))


# Optimized solution
#AC済み
x,y,z,k=list(map(int,input().split()))
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()])
a.sort()
b.sort()
c.sort()
ab=[a[i]+b[j] for j in range(y) for i in range(x)]
ab.sort(reverse=True)
ab=ab[:k]
l=len(ab)
abc=[ab[i]+c[j] for j in range(z) for i in range(l)]
abc.sort(reverse=True)
for i in range(k):
    print((abc[i]))
# Original solution
#AC済み
x,y,z,k=list(map(int,input().split()))
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()])
ab=[a[i]+b[j] for j in range(y) for i in range(x)]
ab.sort(reverse=True)
ab=ab[:k]
l=len(ab)
abc=[ab[i]+c[j] for j in range(z) for i in range(l)]
abc.sort(reverse=True)
for i in range(k):
    print((abc[i]))


# Optimized solution
#AC済み
x,y,z,k=list(map(int,input().split()))
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()])
ab=sorted([a[i]+b[j] for j in range(y) for i in range(x)],reverse=True)
ab=ab[:k]
l=len(ab)
abc=sorted([ab[i]+c[j] for j in range(z) for i in range(l)],reverse=True)
for i in range(k):
    print((abc[i]))
# Original solution
import itertools
X, Y, Z, K = list(map(int, input().rstrip().split()))
A = list(map(int, input().rstrip().split()))
B = list(map(int, input().rstrip().split()))
C = list(map(int, input().rstrip().split()))
A.sort()
B.sort()
C.sort()
combinations = list(itertools.product(A, B, C))
total = []
for combination in combinations:
    total.append(sum(combination))
total.sort(reverse=True)
for i in range(K):
    print((total[i]))

# Optimized solution
import itertools
X, Y, Z, K = list(map(int, input().rstrip().split()))
A = list(map(int, input().rstrip().split()))
B = list(map(int, input().rstrip().split()))
C = list(map(int, input().rstrip().split()))
A.sort()
B.sort()
C.sort()
if X*Y*Z != K:
    if X >= 200:
        A = A[:200]
    if Y >= 200:
        B = B[:200]
    if Z >= 200:
        C = C[:200]
combinations = list(itertools.product(A, B, C))
total = []
for combination in combinations:
    total.append(sum(combination))
total.sort(reverse=True)
for i in range(K):
    print((total[i]))
# Original 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()))
used = [[[False] * (z + 1) for _ in range(y + 1)] for _ in range(x + 1)]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
kouho = [(-(A[0] + B[0] + C[0]), 0, 0, 0)]


def calc(a, b, c):
    if not used[a][b][c]:
        used[a][b][c] = True
        heappush(kouho, ((-A[a] - B[b] - C[c]), a, b, c))


used[0][0][0] = True
for i in range(k):
    temp, p, q, r = heappop(kouho)
    temp *= -1
    print(temp)
    if p + 1 < x:
        calc(p + 1, q, r)
    if q + 1 < y:
        calc(p, q + 1, r)
    if r + 1 < z:
        calc(p, q, r + 1)


# Optimized solution
# pypyでギリ。
import sys

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

x, y, z, k = map(int, readline().split())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
goukei = []
for a in A:
    for b in B:
        goukei.append(a + b)
goukei.sort()
goukei2 = goukei[-k:]
goukei3 = []
for c in C:
    for ab in goukei2:
        goukei3.append(ab + c)
goukei3.sort(reverse=True)
print(*goukei3[:k], sep="\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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

tmp=[]
for i in range(x):
    for j in range(y):
        tmp.append(a[i]+b[j])
tmp.sort(reverse=True)
ans=[]
for i in tmp[:3000]:
    for j in range(z):
        ans.append(i+c[j])
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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans=[]
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
            ans.append(a[i]+b[j]+c[k])
ans.sort(reverse=True)
for i in range(K):
    print((ans[i]))
# Original solution
import math
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=[]
stat=int(math.sqrt(10**7//X))
for i in range(X):
    for j in range(min(stat,Y)):
        for k in range(min(stat,Z)):
            l.append(A[i] + B[j] + C[k])
end1=stat
stat2=int(math.sqrt(10**7//Y))
for i in range(min(stat,X),min(stat+stat2,X)):
    for j in range(Y):
        for k in range(min(stat,Z),min(stat+stat2,Z)):
            l.append(A[i] + B[j] + C[k])
end2=stat+stat2
stat3=int(math.sqrt(10**7//Z))
for i in range(min(stat+stat2,X),min(stat+stat2+stat3,X)):
    for j in range(min(stat+stat2,Y),min(stat+stat2+stat3,Y)):
        for k in range(Z):
            l.append(A[i] + B[j] + C[k])

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



# Optimized solution
import math
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=[]
#まずX+Yを求め、上から順にソート
#10^6相当の計算
for i in range(X):
    for j in range(Y):
        l.append(A[i] + B[j])
l.sort(reverse=True)
ans=[]
#(X+Y)+Zより、全体の上位を求めるが、Zが何であれ、X+Yの和が上からK番目以下のものは考慮しなくて良い
#(X+YにおいてK+i番目のもの(X+Y)_K+i+Zjが全体でK番以内に食い込めるということは、1~K番目のX+Yにて(X+Y)_1~K+Zj>(X+Y)_K+i+Zjが成立することと矛盾する)
#これで高々10^7相当までのソートでよくなる
for i in range(min(K,len(l))):
    for j in range(Z):
        ans.append(l[i]+C[j])
ans.sort(reverse=True)
for i in range(K):
    print((ans[i]))
# Original solution
import heapq

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

    AA = list([x*(-1) for x in A])
    BB = list([x*(-1) for x in B])
    CC = list([x*(-1) for x in C])

    ans = []
    heapq.heapify(ans)
    for a in AA:
        for b in BB:
            for c in CC:
                heapq.heappush(ans, a+b+c)
    
    for i in range(K):
        print((heapq.heappop(ans)*(-1)))
main()

# Optimized solution
from heapq import heappush, heapify, heappop

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()))
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)
    
    que = []
    heapify(que)
    heappush(que, (-A[0]-B[0]-C[0], 0, 0, 0))
    s = set()
    
    for i in range(K):
        ans = heappop(que)
        print((-ans[0]))
        if(ans[1] < X-1 and not (ans[1]+1, ans[2], ans[3]) in s):
            heappush(que, [-A[ans[1]+1]-B[ans[2]]-C[ans[3]], ans[1]+1, ans[2], ans[3]])
            s.add((ans[1]+1, ans[2], ans[3]))
        if(ans[2] < Y-1 and not (ans[1], ans[2]+1, ans[3]) in s):
            heappush(que, [-A[ans[1]]-B[ans[2]+1]-C[ans[3]], ans[1], ans[2]+1, ans[3]])
            s.add((ans[1], ans[2]+1, ans[3]))
        if(ans[3] < Z-1 and not (ans[1], ans[2], ans[3]+1) in s):
            heappush(que, [-A[ans[1]]-B[ans[2]]-C[ans[3]+1], ans[1], ans[2], ans[3]+1])
            s.add((ans[1], ans[2], ans[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()))
AB = [a + b for a in A for b in B]
AB.sort()
AB.reverse()
ABC = [ab + c for ab in AB for c in C]
ABC.sort()
ABC.reverse()
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()))
AB = [a + b for a in A for b in B]
AB.sort()
AB.reverse()
AB = AB[:min(K, X*Y)]
ABC = [ab + c for ab in AB for c in C]
ABC.sort()
ABC.reverse()
for k in range(min(K, X*Y*Z)):
    print((ABC[k]))
# Original solution
X, Y, Z, K = list(map(int, input().split()))
*A, = sorted(map(int, input().split()), reverse=True)
*B, = sorted(map(int, input().split()), reverse=True)
*C, = sorted(map(int, input().split()), reverse=True)
AB = [A[x]+B[y] for x in range(X) for y in range(Y)]
AB.sort(reverse=True)
AB = AB[:K]
XY = len(AB)
ABC = [AB[xy]+C[z] for xy in range(XY) for z in range(Z)]
ABC.sort(reverse=True)
for k in range(K):
    print((ABC[k]))


# Optimized solution
X, Y, Z, K = list(map(int, input().split()))
*A, = sorted(map(int, input().split()), reverse=True)
*B, = sorted(map(int, input().split()), reverse=True)
*C, = sorted(map(int, input().split()), reverse=True)
AB = [A[x] + B[y] for y in range(Y) for x in range(X)]
AB.sort(reverse=True)
AB = AB[:K]
ABC = [AB[x] + C[z] for z in range(Z) for x in range(len(AB))]
ABC.sort(reverse=True)
for k in range(K):
    print((ABC[k]))
# Original solution
X, Y, Z, K = list(map(int, input().split()))
*A, = sorted(map(int, input().split()), reverse=True)
*B, = sorted(map(int, input().split()), reverse=True)
*C, = sorted(map(int, input().split()), reverse=True)
AB = [A[x] + B[y] for y in range(Y) for x in range(X)]
AB.sort(reverse=True)
AB = AB[:K]
XY = len(AB)
ABC = [AB[xy] + C[z] for z in range(Z) for xy in range(XY)]
ABC.sort(reverse=True)
for k in range(K):
    print((ABC[k]))


# Optimized solution
X, Y, Z, K = list(map(int, input().split()))
*A, = sorted(map(int, input().split()), reverse=True)
*B, = sorted(map(int, input().split()), reverse=True)
*C, = sorted(map(int, input().split()), reverse=True)
AB = [a+b for a in A for b in B]
AB.sort(reverse=True)
AB = AB[:K]
XY = len(AB)
ABC = [ab+c for c in C for ab in AB]
ABC.sort(reverse=True)
ABC = ABC[:K]
for abc in ABC:
    print(abc)