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()))
ABlist = []
ABClist = []

for x in A:
    for y in B:
        sumple = x + y
        ABlist.append(sumple)
        ABlist.sort(reverse=True)
        ABlist = ABlist[:K]

for x in ABlist:
    for z in C:
        test = x + z
        ABClist.append(test)
        ABClist.sort(reverse=True)
        ABClist = ABClist[:K]

for x in ABClist:
    print(x)

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()))
ABlist = []
ABClist = []

for x in A:
    for y in B:
        sumple = x + y
        ABlist.append(sumple)
    ABlist.sort(reverse=True)
    ABlist = ABlist[:K]

for x in ABlist:
    for z in C:
        test = x + z
        ABClist.append(test)
    ABClist.sort(reverse=True)
    ABClist = ABClist[:K]

for x in ABClist:
    print(x)

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)
xyzlist = []
i,Ai,Bi,Ci = 0,1,1,1

while i < K:
    maxtest = 0
    for x in range(0,Ai):
        for y in range(0,Bi):
            for z in range(0,Ci):
                if [x,y,z] in xyzlist:
                    continue
                test = A[x] + B[y] + C[z]
                if test > maxtest:
                    maxtest = test
                    xtest = x
                    ytest = y
                    ztest = z
    print(maxtest)
    xyzlist.append([xtest,ytest,ztest])
    Ai = min(X,max(xtest+2,Ai))
    Bi = min(Y,max(ytest+2,Bi))
    Ci = min(Z,max(ztest+2,Ci))
    i += 1

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()))
ABlist = []
ABClist = []

for x in A:
    for y in B:
        sumple = x + y
        ABlist.append(sumple)
    ABlist.sort(reverse=True)
    ABlist = ABlist[:K]

for x in ABlist:
    for z in C:
        test = x + z
        ABClist.append(test)
    ABClist.sort(reverse=True)
    ABClist = ABClist[:K]

for x in ABClist:
    print(x)

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()))
ABlist = []
ABClist = []

for x in A:
    for y in B:
        sumple = x + y
        ABlist.append(sumple)

ABlist.sort(reverse=True)
ABlist = ABlist[0:min(K,X*Y)]

for x in ABlist:
    for z in C:
        test = x + z
        ABClist.append(test)

ABClist.sort(reverse=True)

for x in range(0,K):
    print(ABClist[x])

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()))
ABlist = []
ABClist = []

for x in A:
    for y in B:
        sumple = x + y
        ABlist.append(sumple)
    ABlist.sort(reverse=True)
    ABlist = ABlist[:K]

for x in ABlist:
    for z in C:
        test = x + z
        ABClist.append(test)
    ABClist.sort(reverse=True)
    ABClist = ABClist[:K]

for x in ABClist:
    print(x)