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())))
D = []
E = []
for i in range(x):
  for j in range(y):
    D.append(A[i]+B[j])
D = sorted(D,reverse=True)[:k]
for j in range(len(D)):
  for i in range(z):
    E.append(C[i]+D[j])
E = sorted(E, reverse=True)
for i in range(k):
  print(E[i])

Fixed submission:
x, y, z, k = [int(n) for n in input().split()]
va = sorted([int(n) for n in input().split()], reverse=True)
vb = sorted([int(n) for n in input().split()], reverse=True)
xy = min(x*y, k)
vab = (sorted([a + b for a in va for b in vb], reverse=True))[:xy]
vc = sorted([int(n) for n in input().split()], reverse=True)
xyz = min(x*y*z, k)
print(*((sorted([ab + c for ab in vab for c in vc], reverse=True))[:xyz]), sep="\n")

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())))
D = []
E = []
for i in range(x):
  for j in range(y):
    D.append(A[i]+B[j])
D = sorted(D, reverse=True)
for j in range(len(D)):
  for i in range(z):
    E.append(C[i]+D[j])
E = sorted(E, reverse=True)
for i in range(k):
  print(E[i])

Fixed submission:
x, y, z, k = [int(n) for n in input().split()]
va = sorted([int(n) for n in input().split()], reverse=True)
vb = sorted([int(n) for n in input().split()], reverse=True)
xy = min(x*y, k)
vab = (sorted([a + b for a in va for b in vb], reverse=True))[:xy]
vc = sorted([int(n) for n in input().split()], reverse=True)
xyz = min(x*y*z, k)
print(*((sorted([ab + c for ab in vab for c in vc], reverse=True))[:xyz]), sep="\n")

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())))
D = []
E = []
for i in range(x):
  for j in range(y):
    D.append(A[i]+B[j])
D.sort()
for i in range(z):
  for j in range(min(len(D),k)):
    E.append(C[i]+D[::-1][j])
print("\n".join(map(str,sorted(E)[::-1][:k])))


Fixed submission:
x, y, z, k = [int(n) for n in input().split()]
va = sorted([int(n) for n in input().split()], reverse=True)
vb = sorted([int(n) for n in input().split()], reverse=True)
xy = min(x*y, k)
vab = (sorted([a + b for a in va for b in vb], reverse=True))[:xy]
vc = sorted([int(n) for n in input().split()], reverse=True)
xyz = min(x*y*z, k)
print(*((sorted([ab + c for ab in vab for c in vc], reverse=True))[:xyz]), sep="\n")

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()))
D = []
E = []
for i in range(x):
  for j in range(y):
    D.append(A[i]+B[j])
D.sort()
for i in range(z):
  for j in range(1, k+1):
    E.append(C[i]+D[-j])
print("\n".join(map(str,sorted(E)[::-1][:k])))


Fixed submission:
x, y, z, k = [int(n) for n in input().split()]
va = sorted([int(n) for n in input().split()], reverse=True)
vb = sorted([int(n) for n in input().split()], reverse=True)
xy = min(x*y, k)
vab = (sorted([a + b for a in va for b in vb], reverse=True))[:xy]
vc = sorted([int(n) for n in input().split()], reverse=True)
xyz = min(x*y*z, k)
print(*((sorted([ab + c for ab in vab for c in vc], reverse=True))[:xyz]), sep="\n")

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()))
D = []
E = []
for i in range(x):
  for j in range(y):
    D.append(A[i]+B[j])
for i in range(z):
  for j in range(len(D)):
    E.append(C[i]+D[j])
print("\n".join(map(str,sorted(E)[::-1][:k])))


Fixed submission:
x, y, z, k = [int(n) for n in input().split()]
va = sorted([int(n) for n in input().split()], reverse=True)
vb = sorted([int(n) for n in input().split()], reverse=True)
xy = min(x*y, k)
vab = (sorted([a + b for a in va for b in vb], reverse=True))[:xy]
vc = sorted([int(n) for n in input().split()], reverse=True)
xyz = min(x*y*z, k)
print(*((sorted([ab + c for ab in vab for c in vc], reverse=True))[:xyz]), sep="\n")

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()))
D = []
E = []
for i in range(x):
  for j in range(y):
    D.append(A[i]+B[j])
for i in range(z):
  for j in range(len(D)):
    E.append(C[i]+D[j])
print("\n".join(map(str,sorted(E)[::-1][:min(3000,k)])))


Fixed submission:
x, y, z, k = [int(n) for n in input().split()]
va = sorted([int(n) for n in input().split()], reverse=True)
vb = sorted([int(n) for n in input().split()], reverse=True)
xy = min(x*y, k)
vab = (sorted([a + b for a in va for b in vb], reverse=True))[:xy]
vc = sorted([int(n) for n in input().split()], reverse=True)
xyz = min(x*y*z, k)
print(*((sorted([ab + c for ab in vab for c in vc], reverse=True))[:xyz]), sep="\n")