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

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

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

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

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

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

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

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

AB = AB[:K]
C.sort(reverse=True)
C = C[:K]
ABC = []
i = 0
for c in C:
    # if i >= K: break
    for ab in AB:
        ABC.append(ab+c)
        i += 1

ABC.sort(reverse=True)

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

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

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

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

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

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

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

ABC.sort(reverse=True)

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

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

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

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

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

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

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

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

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

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