Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product

X, Y, Z, K = 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])

Fixed submission:
from itertools import product

X, Y, Z, K = 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])

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product

X, Y, Z, K = 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 = []
mXY = min(X, Y)
for i, j in product(A, B):
    a.append(i + j)
a.sort(reverse=True)
a1 = a[0:K]

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

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


Fixed submission:
from itertools import product

X, Y, Z, K = 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])

Buggy python submission (verdict: Runtime Error):
from itertools import product

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

a1 = []
mXY = min(X, Y)
for i, j in product(A[0:min(mXY, 3000)], B[0:min(mXY, 3000)]):
    a1.append(i + j)
a1.sort(reverse=True)

ans_list = []
for i, j in product(a1[0:min(mXY, 3000)], C[0:min(Z, 3000)]):
    ans_list.append(i + j)
ans_list.sort(reverse=True)

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


Fixed submission:
from itertools import product

X, Y, Z, K = 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])

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product

X, Y, Z, K = 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()]

a1 = []
for i, j in product(A, B):
    a1.append(i + j)
a1.sort(reverse=True)

ans_list = []
for i, j in product(a1[0:min(X*Y*Z, 3000)], C):
    ans_list.append(i + j)
ans_list.sort(reverse=True)

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

Fixed submission:
from itertools import product

X, Y, Z, K = 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])

Buggy python submission (verdict: Runtime Error):
from itertools import product

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

if X * Y * Z > 3000:
    X = 3000
    Y = 3000
    Z = 3000

a1 = []
mXY = min(X,Y)
for i, j in product(A[0:mXY], B[0:mXY]):
    a1.append(i + j)
a1.sort(reverse=True)

ans_list = []
for i, j in product(a1[0:min(mXY,Z)], C[0:min(mXY,Z)]):
    ans_list.append(i + j)

ans_list.sort(reverse=True)

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


Fixed submission:
from itertools import product

X, Y, Z, K = 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])

Buggy python submission (verdict: Runtime Error):
X, Y, Z, K = 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)

if X * Y * Z > 3000:
    X = 3000
    Y = 3000
    Z = 3000

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


Fixed submission:
from itertools import product

X, Y, Z, K = 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])

Buggy python submission (verdict: Runtime Error):
X, Y, Z, K = 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()
A.reverse()
B.sort()
B.reverse()
C.sort()
C.reverse()

if X * Y * Z > 3000:
    X = 3000
    Y = 3000
    Z = 3000

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

Fixed submission:
from itertools import product

X, Y, Z, K = 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])

Buggy python submission (verdict: Runtime Error):
X, Y, Z, K = 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()
A.reverse()
B.sort()
B.reverse()
C.sort()
C.reverse()

if X * Y * Z > 3000:
    X = 3000
    Y = 3000
    Z = 3000

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

Fixed submission:
from itertools import product

X, Y, Z, K = 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])