Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left as bl
from collections import deque as dq
X, Y, Z, K = map(int, input().split())
ABC = [sorted(list(map(int, input().split()))) for _ in range(3)]
AB = []
for i in range(X):
  for j in range(Y):
    AB.append(ABC[0][i] + ABC[1][j])
AB.sort(reverse = True)
res = []
for i in range(min(K, X * Y)):
  for j in range(Z):
    res.append(AB[i] + ABC[2][j])
res.sort(reverse = True)
for i in range(K):
  print(res[i])

Fixed submission:
from bisect import bisect_left as bl
from collections import deque as dq
X, Y, Z, K = map(int, input().split())
ABC = [sorted(list(map(int, input().split()))) for _ in range(3)]
AB = []
for i in range(X):
  for j in range(Y):
    AB.append(ABC[0][i] + ABC[1][j])
AB.sort(reverse = True)
res = []
for i in range(min(K, X * Y)):
  for j in range(Z):
    res.append(AB[i] + ABC[2][j])
res.sort(reverse = True)
for i in range(K):
  print(res[i])

Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left as bl
from collections import deque as dq
X, Y, Z, K = map(int, input().split())
ABC = [sorted(list(map(int, input().split()))) for _ in range(3)]
AB = []
for i in range(X):
  for j in range(Y):
    AB.append(ABC[0][i] + ABC[1][j])
AB.sort(reverse = True)
res = []
for i in range(K):
  for j in range(Z):
    res.append(AB[i] + ABC[2][j])
res.sort(reverse = True)
for i in range(K):
  print(res[i])

Fixed submission:
from bisect import bisect_left as bl
from collections import deque as dq
X, Y, Z, K = map(int, input().split())
ABC = [sorted(list(map(int, input().split()))) for _ in range(3)]
AB = []
for i in range(X):
  for j in range(Y):
    AB.append(ABC[0][i] + ABC[1][j])
AB.sort(reverse = True)
res = []
for i in range(min(K, X * Y)):
  for j in range(Z):
    res.append(AB[i] + ABC[2][j])
res.sort(reverse = True)
for i in range(K):
  print(res[i])

Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left as bl
from collections import deque as dq
X, Y, Z, K = map(int, input().split())
ABC = [sorted(list(map(int, input().split()))) for _ in range(3)]
temp = []
minabc = bl((X, Y, Z), min(X, Y, Z))
abcs = [i for i in range(3) if i != minabc]
for i in range((X, Y, Z)[abcs[0]]):
  for j in range((X, Y, Z)[abcs[1]]):
    temp.append(ABC[abcs[0]][i] + ABC[abcs[1]][j])
temp.sort()
r = len(temp) - 1
u = 0
Q = dq([])
Q.append([r, u])
res = []
visited = [[0] * len(temp) for _ in range((X, Y, Z)[minabc])]
while len(Q):
  q = Q.popleft()
  res.append(temp[q[0]] + ABC[minabc][q[1]])
  if r - q[0] + q[1] > K:
    continue
  if q[0] != 0 and visited[q[1]][q[0] - 1] == 0:
    Q.append([q[0] - 1, q[1]])
    visited[q[1]][q[0] - 1] = 1
  if q[1] != (X, Y, Z)[minabc] - 1 and visited[q[1] + 1][q[0] - 1] == 0:
    Q.append([q[0], q[1] + 1])
    visited[q[1] + 1][q[0]] = 1
res.sort()
for _ in range(K):
  print(res.pop())

Fixed submission:
from bisect import bisect_left as bl
from collections import deque as dq
X, Y, Z, K = map(int, input().split())
ABC = [sorted(list(map(int, input().split()))) for _ in range(3)]
AB = []
for i in range(X):
  for j in range(Y):
    AB.append(ABC[0][i] + ABC[1][j])
AB.sort(reverse = True)
res = []
for i in range(min(K, X * Y)):
  for j in range(Z):
    res.append(AB[i] + ABC[2][j])
res.sort(reverse = True)
for i in range(K):
  print(res[i])

Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left as bl
from collections import deque as dq
X, Y, Z, K = map(int, input().split())
ABC = [sorted(list(map(int, input().split()))) for _ in range(3)]
temp = []
minabc = bl((X, Y, Z), min(X, Y, Z))
abcs = [i for i in range(3) if i != minabc]
for i in range((X, Y, Z)[abcs[0]]):
  for j in range((X, Y, Z)[abcs[1]]):
    temp.append(ABC[abcs[0]][i] + ABC[abcs[1]][j])
temp.sort()
r = len(temp) - 1
u = 0
Q = dq([])
Q.append([r, u])
res = []
visited = [[0] * len(temp) for _ in range((X, Y, Z)[minabc])]
while len(Q):
  q = Q.popleft()
  res.append(temp[q[0]] + ABC[minabc][q[1]])
  if r - q[0] + q[1] > K:
    continue
  if q[0] != 0 and visited[q[1]][q[0] - 1] == 0:
    Q.append([q[0] - 1, q[1]])
    visited[q[1]][q[0] - 1] = 1
  if q[1] != (X, Y, Z)[minabc] - 1 and visited[q[1] + 1][q[0] - 1] == 0:
    Q.append([q[0], q[1] + 1])
    visited[q[1] + 1][q[0]] = 1
res.sort()
for _ in range(K):
  print(res.pop())

Fixed submission:
from bisect import bisect_left as bl
from collections import deque as dq
X, Y, Z, K = map(int, input().split())
ABC = [sorted(list(map(int, input().split()))) for _ in range(3)]
AB = []
for i in range(X):
  for j in range(Y):
    AB.append(ABC[0][i] + ABC[1][j])
AB.sort(reverse = True)
res = []
for i in range(min(K, X * Y)):
  for j in range(Z):
    res.append(AB[i] + ABC[2][j])
res.sort(reverse = True)
for i in range(K):
  print(res[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()))
res = []
for i in range(X):
  for j in range(Y):
    for k in range(Z):
      res.append(A[i] + B[j] + C[k])
res.sort()
for _ in range(K):
  print(res.pop())

Fixed submission:
from bisect import bisect_left as bl
from collections import deque as dq
X, Y, Z, K = map(int, input().split())
ABC = [sorted(list(map(int, input().split()))) for _ in range(3)]
AB = []
for i in range(X):
  for j in range(Y):
    AB.append(ABC[0][i] + ABC[1][j])
AB.sort(reverse = True)
res = []
for i in range(min(K, X * Y)):
  for j in range(Z):
    res.append(AB[i] + ABC[2][j])
res.sort(reverse = True)
for i in range(K):
  print(res[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()))
res = []
for i in range(X):
  for j in range(Y):
    for k in range(Z):
      res.append(A[i] + B[j] + C[k])
res.sort()
for _ in range(K):
  print(res.pop())

Fixed submission:
from bisect import bisect_left as bl
from collections import deque as dq
X, Y, Z, K = map(int, input().split())
ABC = [sorted(list(map(int, input().split()))) for _ in range(3)]
AB = []
for i in range(X):
  for j in range(Y):
    AB.append(ABC[0][i] + ABC[1][j])
AB.sort(reverse = True)
res = []
for i in range(min(K, X * Y)):
  for j in range(Z):
    res.append(AB[i] + ABC[2][j])
res.sort(reverse = True)
for i in range(K):
  print(res[i])