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()))

ans1=[]
ans2=[]

for i in range(x):
    for j in range(y):
        ans1.append(a[i]+b[j])
ans1.sort()
ans1.reverse()

if len(ans1)>=k:
    del ans1[k:]
    
for i in range(k):
    for j in range(z):
        ans2.append(ans1[i]+c[j])
ans2.sort()
ans2.reverse()

for i in range(k):
    print(ans2[i])


            
            
    

        

    
    


        
    

Fixed submission:
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()))

ans1=[]
ans2=[]

for i in range(x):
    for j in range(y):
        ans1.append(a[i]+b[j])
ans1.sort()
ans1.reverse()

if len(ans1)>=k:
    del ans1[k:]
    
for i in range(len(ans1)):
    for j in range(z):
        ans2.append(ans1[i]+c[j])
ans2.sort()
ans2.reverse()

for i in range(k):
    print(ans2[i])

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()))

ans1=[]
ans2=[]

for i in range(x):
    for j in range(y):
        ans1.append(a[i]+b[j])
ans1.sort()
ans1.reverse()

if len(ans1)>=k:
    del ans1[k:]
    
for i in range(k):
    for j in range(z):
        ans2.append(ans1[i]+c[j])
ans2.sort()
ans2.reverse()

for i in range(k):
    print(ans2[i])


            
            
    

        

    
    


        
    

Fixed submission:
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()))

ans1=[]
ans2=[]

for i in range(x):
    for j in range(y):
        ans1.append(a[i]+b[j])
ans1.sort()
ans1.reverse()

if len(ans1)>=k:
    del ans1[k:]
    
for i in range(len(ans1)):
    for j in range(z):
        ans2.append(ans1[i]+c[j])
ans2.sort()
ans2.reverse()

for i in range(k):
    print(ans2[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())) 
e=[]
d=[]
 
a.sort()
b.sort()
c.sort()
 
for i in range(1,x+1):
    for j in range(1,y+1):
        e.append(a[-i]+b[-j])
e.sort()

del e[:-k]
for i in range(1,len(e)+1):
    for j in range(1,z+1):
        d.append(e[-i]+c[-j])
        
d.sort()
for i in range(1,k+1):
    print(d[-i])

Fixed submission:
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()))

ans1=[]
ans2=[]

for i in range(x):
    for j in range(y):
        ans1.append(a[i]+b[j])
ans1.sort()
ans1.reverse()

if len(ans1)>=k:
    del ans1[k:]
    
for i in range(len(ans1)):
    for j in range(z):
        ans2.append(ans1[i]+c[j])
ans2.sort()
ans2.reverse()

for i in range(k):
    print(ans2[i])

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())) 
e=[]
d=[]
 
a.sort()
b.sort()
c.sort()
 
for i in range(1,x+1):
    for j in range(1,y+1):
        e.append(a[-i]+b[-j])
e.sort()
del e[:-k]
for i in range(1,k+1):
    for j in range(1,z+1):
        d.append(e[-i]+c[-j])
        
d.sort()
for i in range(1,k+1):
    print(d[-i])

Fixed submission:
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()))

ans1=[]
ans2=[]

for i in range(x):
    for j in range(y):
        ans1.append(a[i]+b[j])
ans1.sort()
ans1.reverse()

if len(ans1)>=k:
    del ans1[k:]
    
for i in range(len(ans1)):
    for j in range(z):
        ans2.append(ans1[i]+c[j])
ans2.sort()
ans2.reverse()

for i in range(k):
    print(ans2[i])