Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

import sys
input = sys.stdin.readline

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

bimi = []
for a in range(X):
        for b in range(Y):
                bimi.append(A[a] + B[b])

bimi.sort(reverse=True)
ans = []
for x in range(min(K, len(bimi))):
        for c in range(Z):
                ans.append(bimi[x] + C[c])

ans.sort(reverse=True)

for i in range(K):
        print(ans[i])



Fixed submission:
# coding: utf-8

import sys
input = sys.stdin.readline

X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

bimi = []

for a in range(X):
        for b in range(Y):
                if (a + 1) * (b + 1) > K:
                                break

                for c in range(Z):
                        if (a + 1) * (b + 1) * (c + 1) > K:
                                break

                        bimi.append(A[a] + B[b] + C[c])

bimi.sort(reverse=True)

for i in range(K):
        print(bimi[i])

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

import sys
input = sys.stdin.readline

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

bimi = []
for a in range(X):
        for b in range(Y):
                bimi.append(A[a] + B[b])

bimi.sort(reverse=True)
ans = []
for x in range(min(3000, len(bimi))):
        for c in range(Z):
                ans.append(bimi[x] + C[c])

ans.sort(reverse=True)

for i in range(K):
        print(ans[i])



Fixed submission:
# coding: utf-8

import sys
input = sys.stdin.readline

X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

bimi = []

for a in range(X):
        for b in range(Y):
                if (a + 1) * (b + 1) > K:
                                break

                for c in range(Z):
                        if (a + 1) * (b + 1) * (c + 1) > K:
                                break

                        bimi.append(A[a] + B[b] + C[c])

bimi.sort(reverse=True)

for i in range(K):
        print(bimi[i])

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

import sys
input = sys.stdin.readline

X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

bimi = []
cnt = -100000000

def roop():
        global cnt
        for a in range(X):
                for b in range(Y):
                        for c in range(Z):
                                bimi.append(A[a] + B[b] + C[c])
                                cnt += 1

                                if cnt == K:
                                        return

roop()
bimi.sort(reverse=True)

for x in range(K):
        print(bimi[x])



Fixed submission:
# coding: utf-8

import sys
input = sys.stdin.readline

X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

bimi = []

for a in range(X):
        for b in range(Y):
                if (a + 1) * (b + 1) > K:
                                break

                for c in range(Z):
                        if (a + 1) * (b + 1) * (c + 1) > K:
                                break

                        bimi.append(A[a] + B[b] + C[c])

bimi.sort(reverse=True)

for i in range(K):
        print(bimi[i])