Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.readline

X,Y,Z,K = map(int,readline().split())

A = sorted(list(map(int,readline().split())),reverse = True)
B = sorted(list(map(int,readline().split())),reverse = True)
C = sorted(list(map(int,readline().split())),reverse = True)

# AとBを組み合わせたケーキの上位K位を作る
AB = []
for a in range(len(A)):
  for b in range(len(B)):
    AB += [A[a] + B[b]]
    
AB = sorted(AB,reverse = True)[:K]

# ABとCを組み合わせたケーキの上位K位を作る
ans = []
for ab in range(len(AB)):
  for c in range(len(C)):
    ans += [AB[ab] + C[c]]
    
ans = sorted(ans,reverse = True)[:K]
for a in ans:
  print(a)

Fixed submission:
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
B=sorted(list(map(int,input().split())))[::-1]
C=sorted(list(map(int,input().split())))[::-1]
ans=[]
for a in range(len(A)):
  for b in range(len(B)):
    for c in range(len(C)):
      if (a+1)*(b+1)*(c+1)>K:
        break
      ans.append(A[a]+B[b]+C[c])

ans=sorted(ans)[::-1]
for i in range(min(K,len(ans))):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.readline

X,Y,Z,K = map(int,readline().split())

A = sorted(list(map(int,readline().split())),reverse = True)
B = sorted(list(map(int,readline().split())),reverse = True)
C = sorted(list(map(int,readline().split())),reverse = True)

# Aからa個、Bからb個、Cからc個選ぶ
# a * b * c >= Kとなること
# 全探索する上で、条件から外れるものを除外する

ans = []
for a in range(min(K,len(A))):
  for b in range(len(B)):
    for c in range(len(C)):
      ans.append(A[a] + B[b] + C[c])
      if a * b * c > K:
        break

ans = sorted(ans,reverse = True)
for i in range(K):
  print(ans[i])

Fixed submission:
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
B=sorted(list(map(int,input().split())))[::-1]
C=sorted(list(map(int,input().split())))[::-1]
ans=[]
for a in range(len(A)):
  for b in range(len(B)):
    for c in range(len(C)):
      if (a+1)*(b+1)*(c+1)>K:
        break
      ans.append(A[a]+B[b]+C[c])

ans=sorted(ans)[::-1]
for i in range(min(K,len(ans))):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
B=sorted(list(map(int,input().split())))[::-1]
C=sorted(list(map(int,input().split())))[::-1]
ans=[0]*(K**3)
ind=0
for a in range(len(A)):
  for b in range(len(B)):
    for c in range(len(C)):
      if (a+1)*(b+1)*(c+1)>K:
        break
      ans[ind]=A[a]+B[b]+C[c]
      ind+=1

ans=sorted(ans)[::-1]
for i in range(K):
  print(ans[i])


Fixed submission:
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
B=sorted(list(map(int,input().split())))[::-1]
C=sorted(list(map(int,input().split())))[::-1]
ans=[]
for a in range(len(A)):
  for b in range(len(B)):
    for c in range(len(C)):
      if (a+1)*(b+1)*(c+1)>K:
        break
      ans.append(A[a]+B[b]+C[c])

ans=sorted(ans)[::-1]
for i in range(min(K,len(ans))):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
B=sorted(list(map(int,input().split())))[::-1]
C=sorted(list(map(int,input().split())))[::-1]
ans=[0]*(K**3)
ind=0
for a in range(len(A)):
  for b in range(len(B)):
    for c in range(len(C)):
      if (a+1)*(b+1)*(c+1)>K:
        break
      ans[ind]=A[a]+B[b]+C[c]
      ind+=1

ans=sorted(ans)[::-1]
for i in range(min(K,len(ans))):
  print(ans[i])


Fixed submission:
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
B=sorted(list(map(int,input().split())))[::-1]
C=sorted(list(map(int,input().split())))[::-1]
ans=[]
for a in range(len(A)):
  for b in range(len(B)):
    for c in range(len(C)):
      if (a+1)*(b+1)*(c+1)>K:
        break
      ans.append(A[a]+B[b]+C[c])

ans=sorted(ans)[::-1]
for i in range(min(K,len(ans))):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
B=sorted(list(map(int,input().split())))[::-1]
C=sorted(list(map(int,input().split())))[::-1]
ans=[0]*max((len(A)*len(B)*len(C)),K)
ind=0
for a in range(len(A)):
  for b in range(len(B)):
    for c in range(len(C)):
      if (a+1)*(b+1)*(c+1)>K:
        break
      ans[ind]=A[a]+B[b]+C[c]
      ind+=1

ans=sorted(ans)[::-1]
for i in range(min(K,len(ans))):
  print(ans[i])


Fixed submission:
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
B=sorted(list(map(int,input().split())))[::-1]
C=sorted(list(map(int,input().split())))[::-1]
ans=[]
for a in range(len(A)):
  for b in range(len(B)):
    for c in range(len(C)):
      if (a+1)*(b+1)*(c+1)>K:
        break
      ans.append(A[a]+B[b]+C[c])

ans=sorted(ans)[::-1]
for i in range(min(K,len(ans))):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
B=sorted(list(map(int,input().split())))[::-1]
C=sorted(list(map(int,input().split())))[::-1]
ans=[0]*(len(A)*len(B)*len(C))
ind=0
for a in range(len(A)):
  for b in range(len(B)):
    for c in range(len(C)):
      if (a+1)*(b+1)*(c+1)>K:
        break
      ans[ind]=A[a]+B[b]+C[c]
      ind+=1

ans=sorted(ans)[::-1]
for i in range(K):
  print(ans[i])

Fixed submission:
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
B=sorted(list(map(int,input().split())))[::-1]
C=sorted(list(map(int,input().split())))[::-1]
ans=[]
for a in range(len(A)):
  for b in range(len(B)):
    for c in range(len(C)):
      if (a+1)*(b+1)*(c+1)>K:
        break
      ans.append(A[a]+B[b]+C[c])

ans=sorted(ans)[::-1]
for i in range(min(K,len(ans))):
  print(ans[i])