Buggy python submission (verdict: Time Limit Exceeded):
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()))
sum = 0
ans = []
ans2 = []

for i in range(X):
    for j in range(Y):
        sum = A[i] + B[j]
        ans.append(sum)
ans.sort(reverse=True)

for i in range(min(K,len(ans))):
    for j in range(Z):
        sum = ans[i] + C[j]
        ans2.append(sum)
ans2.sort(reverse=True)

for l in range(K):
    print(ans2[l])

Fixed submission:
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)

ans = []

for i in range(X):
    for j in range(Y):
        if (i+1)*(j+1) > K:
            break
        for t in range(Z):
            if (i+1)*(j+1)*(t+1) > K:
                break
            ans.append(A[i]+B[j]+C[t])
ans.sort(reverse=True)

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

Buggy python submission (verdict: Time Limit Exceeded):
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()))
sum = 0
ans = []
ans2 = []
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
for i in range(X):
    for j in range(Y):
        sum = A[i] + B[j]
        ans.append(sum)
ans.sort(reverse=True)

for i in range(min(K,len(ans))):
    for j in range(Z):
        sum = ans[i] + C[j]
        ans2.append(sum)
ans2.sort(reverse=True)

for l in range(K):
    print(ans2[l])


Fixed submission:
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)

ans = []

for i in range(X):
    for j in range(Y):
        if (i+1)*(j+1) > K:
            break
        for t in range(Z):
            if (i+1)*(j+1)*(t+1) > K:
                break
            ans.append(A[i]+B[j]+C[t])
ans.sort(reverse=True)

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

Buggy python submission (verdict: Time Limit Exceeded):
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()))
sum = 0
ans = []
ans2 = []
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
for i in range(X):
    for j in range(Y):
        sum = A[i] + B[j]
        ans.append(sum)
ans.sort(reverse=True)

for i in range(min(3000,len(ans))):
    for j in range(Z):
        sum = ans[i] + C[j]
        ans2.append(sum)
ans2.sort(reverse=True)

for l in range(K):
    print(ans2[l])


Fixed submission:
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)

ans = []

for i in range(X):
    for j in range(Y):
        if (i+1)*(j+1) > K:
            break
        for t in range(Z):
            if (i+1)*(j+1)*(t+1) > K:
                break
            ans.append(A[i]+B[j]+C[t])
ans.sort(reverse=True)

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

Buggy python submission (verdict: Time Limit Exceeded):
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()))
sum = 0
ans = []
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
Kto = K*2
while Kto:
    for i in range(X):
        for j in range(Y):
            for k in range(Z):
                sum = A[i]+B[j]+C[k]
                ans.append(sum)
                Kto -= 1
    if i == X-1 and k == Z-1:
        break
ans.sort(reverse=True)

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

Fixed submission:
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)

ans = []

for i in range(X):
    for j in range(Y):
        if (i+1)*(j+1) > K:
            break
        for t in range(Z):
            if (i+1)*(j+1)*(t+1) > K:
                break
            ans.append(A[i]+B[j]+C[t])
ans.sort(reverse=True)

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

Buggy python submission (verdict: Time Limit Exceeded):
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()))
sum = 0
ans = []

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

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


Fixed submission:
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)

ans = []

for i in range(X):
    for j in range(Y):
        if (i+1)*(j+1) > K:
            break
        for t in range(Z):
            if (i+1)*(j+1)*(t+1) > K:
                break
            ans.append(A[i]+B[j]+C[t])
ans.sort(reverse=True)

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