CodeEff/ECCO huggingface dataset:
# Original solution
# coding: utf-8
# Your code here!

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

A = sorted(map(int,input().split()))[::-1]
B = sorted(map(int,input().split()))[::-1]
C = sorted(map(int,input().split()))[::-1]

AB = sorted([a+b for a in A for b in B])[::-1]

ans = sorted([ab + c for ab in AB for c in C])[::-1]

for i in ans[:k]:
    print(i)



# Optimized solution
# coding: utf-8
# Your code here!

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

A = sorted(map(int,input().split()))[::-1]
B = sorted(map(int,input().split()))[::-1]
C = sorted(map(int,input().split()))[::-1]

AB = sorted([a+b for a in A for b in B])[::-1]

ans = sorted([ab + c for ab in AB[:k] for c in C])[::-1]

for i in ans[:k]:
    print(i)
# Original solution
x,y,z,k = list(map(int,input().split()))
 
A = sorted(map(int,input().split()))[::-1]
B = sorted(map(int,input().split()))[::-1]
C = sorted(map(int,input().split()))[::-1]
 
AB = sorted([a+b for a in A for b in B])[::-1]
 
ans = sorted([ab + c for ab in AB[:k] for c in C])[::-1]
 
for i in ans[:k]:
    print(i)

# Optimized solution
# coding: utf-8
# Your code here!

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

A = sorted(map(int,input().split()))[::-1]
B = sorted(map(int,input().split()))[::-1]
C = sorted(map(int,input().split()))[::-1]

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

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

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

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)

AB = []
for p in itertools.product(A, B):
    AB.append(sum(p))
AB = sorted(AB, reverse=True)[:K]

l = []
for p in itertools.product(AB, C):
    l.append(sum(p))
l = sorted(l, reverse=True)[:K]
for i in range(K):
    print((l[i]))

# 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()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)

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

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

# Optimized solution
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)

AB = []
ABC = []
for b in B:
    for a in A:
        AB.append(a+b)
AB.sort(reverse=True)
# AB = AB[:K]
AB = AB[:min(3001, X*Y*Z+1)]

for c in C:
    for ab in AB:
        ABC.append(ab+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()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)

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

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

# Optimized solution
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)

ABC = []
for xi in range(X):
    if xi+1 > K:
        break
    for yi in range(Y):
        if (xi+1)*(yi+1) > K:
            break
        for zi in range(Z):
            if (xi+1)*(yi+1)*(zi+1) > K:
                break
            ABC.append(A[xi]+B[yi]+C[zi])
ABC.sort(reverse=True)
for i in range(K):
    print((ABC[i]))
# Original solution
#!/usr/bin/env python3
import sys
import itertools


def solve(X: int, Y: int, Z: int, K: int, A: "List[int]", B: "List[int]", C: "List[int]"):
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)

    com = list( itertools.product(A,B,C) )

    S = list([sum(c) for c in com])
    S.sort(reverse=True)

    for k in range(K):
        print((S[k]))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    Z = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(X) ]  # type: "List[int]"
    B = [ int(next(tokens)) for _ in range(Y) ]  # type: "List[int]"
    C = [ int(next(tokens)) for _ in range(Z) ]  # type: "List[int]"
    solve(X, Y, Z, K, A, B, C)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys
import itertools


def solve(X: int, Y: int, Z: int, K: int, A: "List[int]", B: "List[int]", C: "List[int]"):
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)

    AB = list( itertools.product(A,B) )

    ABS = list([sum(c) for c in AB])
    ABS.sort(reverse=True)
    ABS2 = ABS[0:K]

    ABC = list( itertools.product(ABS2,C) )
    ABCS = list([sum(c) for c in ABC])
    ABCS.sort(reverse=True)

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



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    Z = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(X) ]  # type: "List[int]"
    B = [ int(next(tokens)) for _ in range(Y) ]  # type: "List[int]"
    C = [ int(next(tokens)) for _ in range(Z) ]  # type: "List[int]"
    solve(X, Y, Z, K, A, B, C)

if __name__ == '__main__':
    main()
# Original solution
#!/usr/bin/env python3
import sys
import itertools


def solve(X: int, Y: int, Z: int, K: int, A: "List[int]", B: "List[int]", C: "List[int]"):
    AB = list( itertools.product(A,B) )

    ABS = list([sum(c) for c in AB])
    ABS.sort(reverse=True)
    ABS2 = ABS[0:K]

    ABC = list( itertools.product(ABS2,C) )
    ABCS = list([sum(c) for c in ABC])
    ABCS.sort(reverse=True)

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



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    Z = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(X) ]  # type: "List[int]"
    B = [ int(next(tokens)) for _ in range(Y) ]  # type: "List[int]"
    C = [ int(next(tokens)) for _ in range(Z) ]  # type: "List[int]"
    solve(X, Y, Z, K, A, B, C)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys
import itertools


def solve(X: int, Y: int, Z: int, K: int, A: "List[int]", B: "List[int]", C: "List[int]"):
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)

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

    ABC.sort(reverse=True)

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



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    Z = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(X) ]  # type: "List[int]"
    B = [ int(next(tokens)) for _ in range(Y) ]  # type: "List[int]"
    C = [ int(next(tokens)) for _ in range(Z) ]  # type: "List[int]"
    solve(X, Y, Z, K, A, B, C)

if __name__ == '__main__':
    main()
# 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)

ans = []
check = [[[False for i in range(K)] for j in range(K)] for k in range(K)]
q = [[0, 0, 0, 0]]
check[0][0][0] = True
while len(q) > 0:
    i, j, k, step = q.pop(0)
    if step < min(K, 3000):
        ans.append(a[i]+b[j]+c[k])
        if i+1 < x:
            if not check[i+1][j][k]:
                check[i+1][j][k] = True
                q.append([i+1, j, k, step+1])
        if j+1 < y:
            if not check[i][j+1][k]:
                check[i][j+1][k] = True
                q.append([i, j+1, k, step+1])
        if k+1 < z:
            if not check[i][j][k+1]:
                check[i][j][k+1] = True
                q.append([i, j, k+1, step+1])

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


# Optimized solution
import sys
input = sys.stdin.readline

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

    ind = []
    for i in range(x):
        for j in range(y):
            if (i+1)*(j+1) <= K:
                for k in range(z):
                    if (i+1)*(j+1)*(k+1) <= K:
                        ind.append(A[i]+B[j]+C[k])
                    else:
                        break
            else:
                break
    ind = sorted(ind, reverse=True)
    for i in range(K):
        print((ind[i]))

if __name__ == "__main__":
    main()
# Original solution
x, y, z, k = list(map(int,input().split()))
*a, = list(map(int,input().split()))
*b, = list(map(int,input().split()))
*c, = list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

l1 = []
for i in a:
  for j in b:
    l1.append(i+j)
#print(l1)

l2 = []
l1.sort(reverse=True)
for l in l1:
  for m in c:
    l2.append(l+m)
#print(l2)

l2.sort(reverse=True)
for n in range(k):
  print((l2[n]))

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

l1 = []
for i in a:
  for j in b:
    l1.append(i+j)
#print(l1)

l2 = []
l1.sort(reverse=True)
for l in range(len(l1[:k])):
  for m in c:
    l2.append(l1[l]+m)
#print(l2)

l2.sort(reverse=True)
for n in range(k):
  print((l2[n]))
# Original solution
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)
B.sort(reverse=True)
C.sort(reverse=True)

candidates = []
for i, j, k in product(list(range(len(A))), list(range(len(B))), list(range(len(C)))):
    if i * j * k <= K:
        candidates.append(A[i] + B[j] + C[k])
candidates.sort(reverse=True)

for c in candidates[:K]:
    print(c)

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

candidates = []
for i in range(len(A)):
    for j in range(len(B)):
        for k in range(len(C)):
            if (i+1) * (j+1) * (k+1) <= K:
                candidates.append(A[i] + B[j] + C[k])
            else:
                break
candidates.sort(reverse=True)

for c in candidates[:K]:
    print(c)
# Original solution
import itertools

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

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[:K], C))]
ans.sort(reverse = True)

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

# Optimized solution
X, Y, Z, K  = 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)

l = []
for a in A:
    for b in B:
        l.append(a+b)
l = sorted(l, reverse = True)[:K]

ans = []
for c in C:
    for k in l:
        ans.append(c + k)
        
ans = sorted(ans, reverse = True)
print(*ans[:K], sep="\n")
# Original solution
from bisect import insort

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)
for i in range(Z-1, 0, -1) :
    C[i] -= C[i-1]

n = []
for x in range(X) :
    for y in range(Y) :
        n.append((A[x]+B[y]+C[0], 0))
n.sort()

for _ in range(K) :
    cur, z = n.pop()
    print(cur)
    if z < Z - 1 :
        z += 1
        insort(n, (cur+C[z], z))

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

s = []
for x in range(X) :
    for y in range(Y) :
        s.append(A[x]+B[y])
s.sort(reverse=True)

t = []
for k in range(min(K, len(s))) :
    for z in range(Z) :
        t.append(s[k]+C[z])
        
t.sort(reverse=True)

print(("\n".join(map(str, t[:K]))))
# 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()))

l = []

for p in range(0,x):
    for q in range(0,y):
        for r in range(0,z):
            if len(l) > k:
                heapq.heappushpop(l,a[p]+b[q]+c[r])
            else:
                heapq.heappush(l,a[p]+b[q]+c[r])

l.sort()

for i in range(1,k+1):
    print((l[-i]))

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

l = []

for p in range(0,x):
    for q in range(0,y):
        for r in range(0,z):
            if len(l) > k and a[p]+b[q]+c[r] <= l[0]:
                break
            elif len(l) > k:
                heapq.heappushpop(l,a[p]+b[q]+c[r])
            else:
                heapq.heappush(l,a[p]+b[q]+c[r])

l.sort()

for i in range(1,k+1):
    print((l[-i]))
# Original solution
x, y, z, k = [int(x) for x in 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)

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

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


# Optimized solution
x, y, z, k = [int(x) for x in 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)

ans = []
for i in A:
    for j in B:
        ans.append(i+j)
ans.sort(reverse=True)
ans = ans[:k]
ans1 = []
for i in C:
    for j in ans:
        ans1.append(i+j)
ans1.sort(reverse=True)
for i in range(k):
    print((ans1[i]))
# Original solution
N = list(map(int, input().split()))[-1]
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

first = [i+j for i in A for j in B]
first = sorted(first)[::-1]
second = [i+j for i in first for j in C]

print(("\n".join([str(value) for value in sorted(second)[::-1][:N]])))

# Optimized solution
N = list(map(int, input().split()))[-1]
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

first = [i+j for i in A for j in B]
first = sorted(first)[::-1]
second = [first[i]+j for i in range(len(first)) for j in C if i <= N]

print(("\n".join([str(value) for value in sorted(second)[::-1][:N]])))
# Original solution
N = list(map(int, input().split()))[-1]
A = sorted(list(map(int, input().split())), reverse=True)[:N]
B = sorted(list(map(int, input().split())), reverse=True)[:N]
C = sorted(list(map(int, input().split())), reverse=True)[:N]

result = [A[i]+B[j]+C[k] 
          for i in range(len(A)) 
          for j in range(len(B)) 
          for k in range(len(C))
          if i+j+k <= N
         ]
  
result = sorted(result, reverse=True)
[print(result[i]) for i in range(N)]


# Optimized solution
N = list(map(int, input().split()))[-1]
A = sorted(list(map(int, input().split())), reverse=True)[:N]
B = sorted(list(map(int, input().split())), reverse=True)[:N]
C = sorted(list(map(int, input().split())), reverse=True)[:N]

first = [i+j for i in A for j in B]
first = sorted(first, reverse=True)[:N]
second = [i+j for i in first for j in C]
result = sorted(second, reverse=True)[:N]

[print(i) for i in result]
# Original solution
'''
Created on 2020/09/08

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  X,Y,Z,K=list(map(int,pin().split()))
  A=list(map(int,pin().split()))
  B=list(map(int,pin().split()))
  C=list(map(int,pin().split()))
#   A.sort(reverse=True)
#   B.sort(reverse=True)
#   C.sort(reverse=True)

  d=[]
  for i in A:
    for j in B:
      d.append(i+j)
#   d.sort(reverse=True)
  ans=[]
  for k in d:
    for l in C:
      ans.append(k+l)
  ans.sort(reverse=True)
  for m in range(K):
    print((ans[m]))
  return 
main()



# Optimized solution
'''
Created on 2020/09/08

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  X,Y,Z,K=list(map(int,pin().split()))
  A=list(map(int,pin().split()))
  B=list(map(int,pin().split()))
  C=list(map(int,pin().split()))
#   A.sort(reverse=True)
#   B.sort(reverse=True)
#   C.sort(reverse=True)

  d=[]
  for i in A:
    for j in B:
      d.append(i+j)
  d.sort(reverse=True)
  d=d[:K]
  ans=[]
  for k in d:
    for l in C:
      ans.append(k+l)
  ans.sort(reverse=True)
  for m in range(K):
    print((ans[m]))
  return
main()
# Original solution
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)
ans = []

ApB = []

for i in range(min(X, K)):
  for j in range(min(Y, K)):
      ApB.append(A[i] + B[j])

ApB.sort(reverse = True)

for i in range(min(Z, K)):
  for j in range(min(len(ApB), K)):
    ans.append(C[i] + ApB[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(min(X, K)):
  for j in range(min(Y, K)):
    if (i + 1) * (j + 1) > K:
      break
    for k in range(min(Z, K)):
      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
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)
AB = []
ABC = []
for i in A:
        for j in B:
                AB.append(i+j)
AB.sort(reverse = True)
AB = AB[:min(3001,x*y*z+1)]
for i in AB:
        for j in C:
                ABC.append(i+j)
ABC.sort(reverse = True)
for i in range(k):
        print((ABC[i]))

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

A = sorted(A, reverse=True)[:K+1]
B = sorted(B, reverse=True)[:K+1]
C = sorted(C, reverse=True)[:K+1]

res = []

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

res = sorted(res, reverse=True)[:K+1]
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()))

A = sorted(A, reverse=True)[:K+1]
B = sorted(B, reverse=True)[:K+1]
C = sorted(C, reverse=True)[:K+1]

res = []

for i in A:
    for j in B:
        res.append(i + j)
res2 = []
res = sorted(res, reverse=True)[:K+1]

for i in C:
    for re in res:
        res2.append(i + re)
        
res2 = sorted(res2, reverse=True)[:K+1]
          

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

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)

a = []
for i, j in product(A[0:K+1], B[0:K+1]):
    a.append(i + j)

ans_list = []
for i, j in product(a, C[0:K+1]):
    ans_list.append(i + j)
ans_list.sort(reverse=True)

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

# Optimized solution
from itertools import product

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)

a = []
count = 0
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
            a.append(A[i] + B[j] + C[k])

a.sort(reverse=True)

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