Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, 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(reverse=1)
Y.sort(reverse=1)
Z.sort(reverse=1)

answer = []

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:
                answer.append(X[i]+Y[j]+Z[l])

answer.sort(reverse=1)

for p in answer[:k]:
    print(p)

Fixed submission:
x, y, z, k = map(int, 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(reverse=1)
Y.sort(reverse=1)
Z.sort(reverse=1)

answer = [i+j for i in X[:k] for j in Y[:k]]
answer.sort(reverse=1)

answer2 = [i+j for i in Z[:k] for j in answer[:k]]
answer2.sort(reverse=1)

for p in answer2[:k]:
    print(p)

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, 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(reverse=1)
Y.sort(reverse=1)
Z.sort(reverse=1)

answer = []
for i in X[:k]:
    for j in Y[:k]:
        answer.append(i+j)
answer.sort(reverse=1)

answer2 = []
for l in Z[:k]:
    for a in answer[:k]:
        answer2.append(l+a)
answer2.sort(reverse=1)

for p in answer2[:k]:
    print(p)

Fixed submission:
x, y, z, k = map(int, 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(reverse=1)
Y.sort(reverse=1)
Z.sort(reverse=1)

answer = [i+j for i in X[:k] for j in Y[:k]]
answer.sort(reverse=1)

answer2 = [i+j for i in Z[:k] for j in answer[:k]]
answer2.sort(reverse=1)

for p in answer2[:k]:
    print(p)

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, 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()]


answer = []
for i in X:
    for j in Y:
        answer.append(i+j)
answer.sort(reverse=1)

answer2 = []
for l in Z[:k]:
    for a in answer[:k]:
        answer2.append(l+a)
answer2.sort(reverse=1)

for p in answer2[:k]:
    print(p)

Fixed submission:
x, y, z, k = map(int, 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(reverse=1)
Y.sort(reverse=1)
Z.sort(reverse=1)

answer = [i+j for i in X[:k] for j in Y[:k]]
answer.sort(reverse=1)

answer2 = [i+j for i in Z[:k] for j in answer[:k]]
answer2.sort(reverse=1)

for p in answer2[:k]:
    print(p)

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, 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()]

count = []

for i in X:
    for j in Y:
        for l in Z:
            count.append(i+j+l)

count.sort(reverse=1)

for c in range(k):
    print(count[c])


Fixed submission:
x, y, z, k = map(int, 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(reverse=1)
Y.sort(reverse=1)
Z.sort(reverse=1)

answer = [i+j for i in X[:k] for j in Y[:k]]
answer.sort(reverse=1)

answer2 = [i+j for i in Z[:k] for j in answer[:k]]
answer2.sort(reverse=1)

for p in answer2[:k]:
    print(p)