Buggy python submission (verdict: Runtime Error):
k = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
z = [int(i) for i in input().split()]

x.sort(reverse=True)
y.sort(reverse=True)
z.sort(reverse=True)

for i in len(x):
  for j in len(y):
    for l in len(z):
      if (x+1)*(y+1)*(z+1) <= k[3]:
        SUM.append(x[i]+y[j]+z[l])
      else:
        break

SUM.sort(reverse=True)

for i in range(k[3]):
  print(SUM[i])


Fixed submission:
X,Y,Z,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
SUM=[]
for i in range(X):
  for j in range(Y):
    for k in range(Z):
      if (i+1)*(j+1)*(k+1)<=K:
        SUM.append(A[i]+B[j]+C[k])
      else:
        break
SUM.sort(reverse=True)
for i in range(K):
  print(SUM[i])

Buggy python submission (verdict: Runtime Error):
k = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
z = [int(i) for i in input().split()]

x.sort(reverse=True)
y.sort(reverse=True)
z.sort(reverse=True)

for i in len(x)
  for j in len(y)
    for l in len(z)
      if x*y*z =< k[3]:
        SUM.append(x[i+1]+y[j+1]+z[l+1])
      else:
        break

SUM.sort(reverse=True)

for i in range(k[3])
  print(SUM[i])


Fixed submission:
X,Y,Z,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
SUM=[]
for i in range(X):
  for j in range(Y):
    for k in range(Z):
      if (i+1)*(j+1)*(k+1)<=K:
        SUM.append(A[i]+B[j]+C[k])
      else:
        break
SUM.sort(reverse=True)
for i in range(K):
  print(SUM[i])

Buggy python submission (verdict: Runtime Error):
k = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
z = [int(i) for i in input().split()]

x.sort(reverse=True)
y.sort(reverse=True)
z.sort(reverse=True)

for i in len(x)
  for j in len(y)
    for l in len(z)
      if x*y*z =< k[3]:
        SUM.append(x[i]+y[j]+z[l])
      else:
        break

SUM.sort(reverse=True)

for i in range(k[3])
  print(SUM[i])


Fixed submission:
X,Y,Z,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
SUM=[]
for i in range(X):
  for j in range(Y):
    for k in range(Z):
      if (i+1)*(j+1)*(k+1)<=K:
        SUM.append(A[i]+B[j]+C[k])
      else:
        break
SUM.sort(reverse=True)
for i in range(K):
  print(SUM[i])

Buggy python submission (verdict: Runtime Error):
k = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
z = [int(i) for i in input().split()]

x.sort(reverse=True)
if len(x)>k[3]:
  x = x[0:k[3]+1]

y.sort(reverse=True)
if len(y)>k[3]:
  y = y[0:k[3]+1]

z.sort(reverse=True)
if len(z)>k[3]:
  z = z[0:k[3]+1]

e = []

for i in x:
  for j in y:
    e.append(i+j)

g = []
for i in range(k[3]):
  g.append(e[i])

f = []

for i in g:
  for j in z:
    f.append(i+j)

f.sort(reverse=True)

for i in range(k[3]):
  print(f[i])


Fixed submission:
X,Y,Z,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
SUM=[]
for i in range(X):
  for j in range(Y):
    for k in range(Z):
      if (i+1)*(j+1)*(k+1)<=K:
        SUM.append(A[i]+B[j]+C[k])
      else:
        break
SUM.sort(reverse=True)
for i in range(K):
  print(SUM[i])

Buggy python submission (verdict: Runtime Error):
k = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
z = [int(i) for i in input().split()]

x.sort(reverse=True)
if len(x)>k[3]:
  x = x[0:k[3]]

y.sort(reverse=True)
if len(y)>k[3]:
  y = y[0:k[3]]

z.sort(reverse=True)
if len(z)>k[3]:
  z = z[0:k[3]]

e = []

for i in x:
  for j in y:
    e.append(i+j)

g = []
for i in range(k[3]):
  g.append(e[i])

f = []

for i in g:
  for j in z:
    f.append(i+j)

f.sort(reverse=True)

for i in range(k[3]):
  print(f[i])


Fixed submission:
X,Y,Z,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
SUM=[]
for i in range(X):
  for j in range(Y):
    for k in range(Z):
      if (i+1)*(j+1)*(k+1)<=K:
        SUM.append(A[i]+B[j]+C[k])
      else:
        break
SUM.sort(reverse=True)
for i in range(K):
  print(SUM[i])

Buggy python submission (verdict: Runtime Error):
k = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
z = [int(i) for i in input().split()]

e = []

for i in x:
  for j in y:
    e.append(i+j)

e.sort()
e.reverse()
print(e)
g = []
for i in range(k[3]):
  g.append(e[i])


f = []

for i in g:
  for j in z:
    f.append(i+j)

f.sort()
f.reverse()

for i in range(k[3]):
  print(f[i])


Fixed submission:
X,Y,Z,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
SUM=[]
for i in range(X):
  for j in range(Y):
    for k in range(Z):
      if (i+1)*(j+1)*(k+1)<=K:
        SUM.append(A[i]+B[j]+C[k])
      else:
        break
SUM.sort(reverse=True)
for i in range(K):
  print(SUM[i])

Buggy python submission (verdict: Time Limit Exceeded):
k = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
z = [int(i) for i in input().split()]

x.sort()
y.sort()
z.sort()

e = []

for i in x:
  for j in y:
    e.append(i+j)

e.sort()

f = []

for i in e:
  for j in z:
    f.append(i+j)

f.sort()
f.reverse()

for i in range(k[3]):
  print(f[i])


Fixed submission:
X,Y,Z,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
SUM=[]
for i in range(X):
  for j in range(Y):
    for k in range(Z):
      if (i+1)*(j+1)*(k+1)<=K:
        SUM.append(A[i]+B[j]+C[k])
      else:
        break
SUM.sort(reverse=True)
for i in range(K):
  print(SUM[i])