Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,N =(int(i) for i in 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()]

sa=sorted(a,reverse=True)
sb=sorted(b,reverse=True)
sc=sorted(c,reverse=True)
l=[]#端点情報
n=0
i=0
j=0
k=0

while n<N:
  print(sa[i]+sb[j]+sc[k])
  l.append([i,j,k])
  maxl=0
  maxijk=[len(sa)-1,len(sb)-1,len(sc)-1]
  for w in l:
    if w[0]<len(sa)-1:
      if not ([w[0]+1,w[1],w[2]] in l):
        if maxl<=sa[w[0]+1]+sb[w[1]]+sc[w[2]]:
          maxl=sa[w[0]+1]+sb[w[1]]+sc[w[2]]
          maxijk=[w[0]+1,w[1],w[2]]
    if w[1]<len(sb)-1:
      if not([w[0],w[1]+1,w[2]] in l):
        if maxl<=sa[w[0]]+sb[w[1]+1]+sc[w[2]]:
          maxl=sa[w[0]]+sb[w[1]+1]+sc[w[2]]
          maxijk=[w[0],w[1]+1,w[2]]
    if w[2]<len(sc)-1:
      if not([w[0],w[1],w[2]+1] in l):
        if maxl<=sa[w[0]]+sb[w[1]]+sc[w[2]+1]:
          maxl=sa[w[0]]+sb[w[1]]+sc[w[2]+1]
          maxijk=[w[0],w[1],w[2]+1]
    i=maxijk[0]
  j=maxijk[1]
  k=maxijk[2]
  n+=1

Fixed submission:
#解答を見た後


x,y,z,N =(int(i) for i in 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()]

sa=sorted(a,reverse=True)
sb=sorted(b,reverse=True)
sc=sorted(c,reverse=True)
answer=[]

for i in range(len(sa)):
  for j in range(len(sb)):
    if (i+1)*(j+1)>N:break
    for k in range(len(sb)):
      if (i+1)*(j+1)*(k+1)>N:break 
      answer.append(sa[i]+sb[j]+sc[k])
answer=sorted(answer,reverse=True)
for i in range(0,N):
  print(answer[i])

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,N =(int(i) for i in 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()]

sa=sorted(a,reverse=True)
sb=sorted(b,reverse=True)
sc=sorted(c,reverse=True)
l=[]#端点情報
n=0
i=0
j=0
k=0

while n<N:
  print(sa[i]+sb[j]+sc[k])
  l.append([i,j,k])
  maxl=0
  maxijk=[len(sa)-1,len(sb)-1,len(sc)-1]
  for w in l:
    if w[0]>=len(sa)-1:continue
    if [w[0]+1,w[1],w[2]] in l:continue
    if maxl<=sa[w[0]+1]+sb[w[1]]+sc[w[2]]:
      maxl=sa[w[0]+1]+sb[w[1]]+sc[w[2]]
      maxijk=[w[0]+1,w[1],w[2]]
  for w in l:
    if w[1]>=len(sb)-1:continue
    if [w[0],w[1]+1,w[2]] in l:continue
    if maxl<=sa[w[0]]+sb[w[1]+1]+sc[w[2]]:
      maxl=sa[w[0]]+sb[w[1]+1]+sc[w[2]]
      maxijk=[w[0],w[1]+1,w[2]]
  for w in l:
    if w[2]>=len(sc)-1:continue
    if [w[0],w[1],w[2]+1] in l:continue
    if maxl<=sa[w[0]]+sb[w[1]]+sc[w[2]+1]:
      maxl=sa[w[0]]+sb[w[1]]+sc[w[2]+1]
      maxijk=[w[0],w[1],w[2]+1]
  i=maxijk[0]
  j=maxijk[1]
  k=maxijk[2]
  n+=1

Fixed submission:
#解答を見た後


x,y,z,N =(int(i) for i in 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()]

sa=sorted(a,reverse=True)
sb=sorted(b,reverse=True)
sc=sorted(c,reverse=True)
answer=[]

for i in range(len(sa)):
  for j in range(len(sb)):
    if (i+1)*(j+1)>N:break
    for k in range(len(sb)):
      if (i+1)*(j+1)*(k+1)>N:break 
      answer.append(sa[i]+sb[j]+sc[k])
answer=sorted(answer,reverse=True)
for i in range(0,N):
  print(answer[i])

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,N =(int(i) for i in 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()]

answer=[]
for i in range(len(a)):
  for j in range(len(b)):
    for k in range(len(c)):
      answer.append(a[i]+b[j]+c[k])
sortedAnswer=sorted(answer)
for i in range(x*y*z-1,x*y*z-N-1,-1):
  print(sortedAnswer[i])

Fixed submission:
#解答を見た後


x,y,z,N =(int(i) for i in 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()]

sa=sorted(a,reverse=True)
sb=sorted(b,reverse=True)
sc=sorted(c,reverse=True)
answer=[]

for i in range(len(sa)):
  for j in range(len(sb)):
    if (i+1)*(j+1)>N:break
    for k in range(len(sb)):
      if (i+1)*(j+1)*(k+1)>N:break 
      answer.append(sa[i]+sb[j]+sc[k])
answer=sorted(answer,reverse=True)
for i in range(0,N):
  print(answer[i])