Buggy python submission (verdict: Runtime Error):
import heapq
x, y, z,  k = map(int, input().split())
a = list(int(x) for x in input().split())
b = list(int(x) for x in input().split())
c = list(int(x) for x in input().split())

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

ab_1 = []
for i in a:
    for j in b:
        heapq.heappush(ab_1, -i-j)
key = min([k, x*y*z])
ab_2 = []
for i in range(key):
    value = heapq.heappop(ab_1)
    ab_2.append(-value)

abc = []
for p in ab_2:
    for q in c:
        heapq.heappush(abc, -p-q)
for i in range(key):
    value = heapq.heappop(abc)
    print(-value)

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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for j in c:
    for i in p:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[i])

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z,  k = map(int, input().split())
a = list(int(x) for x in input().split())
b = list(int(x) for x in input().split())
c = list(int(x) for x in input().split())

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

ab_1 = []
for i in range(x):
    for j in range(y):
        ab_1.append(a[i]+b[j])
ab_1.sort(reverse=True)   
key = min([k, x*y*z])
ab_2 = ab_1[:key]

abc = []
for p in ab_2:
    for q in c:
        abc.append(p+q)
abc.sort(reverse=True)
for i in range(key):
    print(abc[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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for j in c:
    for i in p:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[i])

Buggy python submission (verdict: Runtime Error):
x, y, z,  k = map(int, input().split())
a = list(int(x) for x in input().split())
b = list(int(x) for x in input().split())
c = list(int(x) for x in input().split())

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

ab_1 = []
for i in range(x):
    for j in range(y):
        ab.append(a[i]*b[j])
ab_1.sort()   
key = min([k, x*y*z])
ab_2 = ab_1[:key]

abc = []
for i in range(key):
    for j in range(z):
        abc.append(ab_2[i]*c[j])
abc.sort()
for i in range(key):
    print(abc[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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for j in c:
    for i in p:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[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())) 
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for h in range(min(x,k)):
    for i in range(y):
        if h*i <= k:
            for j in range(z):
                if h*i*j <= k:
                    p.append(a[h]+b[i]+c[j])

p.sort(reverse=True)
for i in range(k):
    print(p[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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for j in c:
    for i in p:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for i in p:
    for j in c:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for j in c:
    for i in p:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[i])

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for i in p:
    for j in c:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for j in c:
    for i in p:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[i])

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans_list = []
for i in a:
    for j in b:
        ans_list.append(i+j)
ans_list.sort(reverse=True)
ans_list = ans_list[:min(3001, x*y*z+1)]
ans_list_2 = []
for i in ans_list:
    for j in c:
        ans_list_2.append(i+j)
ans_list_2.sort(reverse=True)
for i in range(k):
    print(ans_list_2[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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for j in c:
    for i in p:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[i])

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

ans_list = []
for i in a:
    for j in b:
        ans_list.append(i+j)
ans_list.sort(reverse=True)
ans_list = ans_list[:min(3001, x*y*z+1)]
ans_list_2 = []
for i in ans_list:
    for j in c:
        ans_list_2.append(i+j)
ans_list_2.sort(reverse=True)
for i in range(k):
    print(ans_list_2[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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for j in c:
    for i in p:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[i])

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans_list = []
for h in range(min(x,k)):
    for i in range(min(y,k-h)):
        for j in range(min(z,k-h-i)):
            ans_list.append(a[h]+b[i]+c[j])
ans_list.sort(reverse=True)
for i in range(k):
    print(ans_list[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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for j in c:
    for i in p:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[i])

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans_list = []
for h in range(min(x,k)):
    for i in range(min(y,k)):
        for j in range(min(z,k)):
            ans_list.append(a[h]+b[i]+c[j])
ans_list.sort(reverse=True)
for i in range(k):
    print(ans_list[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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
p = []
for i in a:
    for j in b:
        p.append(i+j)
p.sort(reverse=True)
p = p[:min(3001, x*y*z+1)]
q = []
for j in c:
    for i in p:
        q.append(i+j)
q.sort(reverse=True)
for i in range(k):
    print(q[i])