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

r=[]
out=[]

for i in range(X):
    for j in range(Y):
        r.append(A[i]+B[j])

r.sort(reverse=True)

if len(r)>K:
    for i in range(K):
        for j in range(Z):
            out.append(r[i]+C[j])
else:
    for i in range(len(r)):
        for j in range(Z):
            out.append(r[i]+C[j])

out.sort(reverse=True)

for i in range(K):
    print(out[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()))
     
r=[]
out=[]
     
for i in range(X):
    for j in range(Y):
        r.append(A[i]+B[j])
     
r.sort(reverse=True)
     
if len(r)>K:
    for i in range(K):
        for j in range(Z):
            out.append(r[i]+C[j])
else:
    for i in range(len(r)):
        for j in range(Z):
           out.append(r[i]+C[j])
     
out.sort(reverse=True)
     
for i in range(K):
    print(out[i])

Buggy python submission (verdict: Runtime Error):
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()))

r=[]
out=[]

for i in range(X):
    for j in range(Y):
        r.append(A[i]+B[j])

r.sort(reverse=True)

for i in range(K):
    for j in range(Z):
        out.append(r[i]+C[j])

out.sort(reverse=True)

for i in range(K):
    print(out[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()))
     
r=[]
out=[]
     
for i in range(X):
    for j in range(Y):
        r.append(A[i]+B[j])
     
r.sort(reverse=True)
     
if len(r)>K:
    for i in range(K):
        for j in range(Z):
            out.append(r[i]+C[j])
else:
    for i in range(len(r)):
        for j in range(Z):
           out.append(r[i]+C[j])
     
out.sort(reverse=True)
     
for i in range(K):
    print(out[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()))

out=[]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)


for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if i*j*k<=k:
                out.append(A[i]+B[j]+C[k])

out.sort(reverse=True)

for i in range(K):
    print(out[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()))
     
r=[]
out=[]
     
for i in range(X):
    for j in range(Y):
        r.append(A[i]+B[j])
     
r.sort(reverse=True)
     
if len(r)>K:
    for i in range(K):
        for j in range(Z):
            out.append(r[i]+C[j])
else:
    for i in range(len(r)):
        for j in range(Z):
           out.append(r[i]+C[j])
     
out.sort(reverse=True)
     
for i in range(K):
    print(out[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()))

out=[]

for i in range(X):
    for j in range(Y):
        for k in range(Z):
            out.append(A[i]+B[j]+C[k])

out.sort(reverse=True)

for i in range(K):
    print(out[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()))
     
r=[]
out=[]
     
for i in range(X):
    for j in range(Y):
        r.append(A[i]+B[j])
     
r.sort(reverse=True)
     
if len(r)>K:
    for i in range(K):
        for j in range(Z):
            out.append(r[i]+C[j])
else:
    for i in range(len(r)):
        for j in range(Z):
           out.append(r[i]+C[j])
     
out.sort(reverse=True)
     
for i in range(K):
    print(out[i])