Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int,input().split())
alist = [int(i) for i in input().split()]
blist = [int(i) for i in input().split()]
clist = [int(i) for i in input().split()]


# print(x,y,z,k, alist, blist, clist)

#%%
# x,y,z,k,alist,blist,clist = 2, 2, 2, 8, [4, 6],[1, 5],[3, 8]


#%%
alist.sort()
blist.sort()
clist.sort()
alist = alist[::-1][:k]
blist = blist[::-1][:k]
clist = clist[::-1][:k]

#%%
import itertools




#%%
ans = []
for i in list(itertools.product(alist, blist, clist)):
    ans.append((sum(i)))

ans.sort()
#%%
for i in ans[::-1][:k]:
    print(i)

#%%


Fixed submission:
# https://atcoder.jp/contests/abc123/tasks/abc123_d

def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

X, Y, Z, K = MAP()
A = LIST()
B = LIST()
C = LIST()

# A.sort(reverse=True); B.sort(reverse=True); C.sort(reverse=True)

E = []
for a in A:
    for b in B:
        E.append(a+b)
E.sort(reverse=True)

ans = []

for c in C[:K]:
    for e in E[:K]:
        ans.append(c+e)
ans.sort(reverse=True)

for i, a in enumerate(ans):
    if i < K:
        print(a)
    else:
        break

Buggy python submission (verdict: Time Limit Exceeded):
# https://atcoder.jp/contests/abc123/tasks/abc123_d

def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

X, Y, Z, K = MAP()
A = LIST()
B = LIST()
C = LIST()

# A.sort(reverse=True); B.sort(reverse=True); C.sort(reverse=True)

E = []
for a in A:
    for b in B:
        E.append(a+b)
# E.sort(reverse=True)

ans = []

for c in C:
    for e in E:
        ans.append(c+e)
ans.sort(reverse=True)

for i, a in enumerate(ans):
    if i < K:
        print(a)
    else:
        break

Fixed submission:
# https://atcoder.jp/contests/abc123/tasks/abc123_d

def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

X, Y, Z, K = MAP()
A = LIST()
B = LIST()
C = LIST()

# A.sort(reverse=True); B.sort(reverse=True); C.sort(reverse=True)

E = []
for a in A:
    for b in B:
        E.append(a+b)
E.sort(reverse=True)

ans = []

for c in C[:K]:
    for e in E[:K]:
        ans.append(c+e)
ans.sort(reverse=True)

for i, a in enumerate(ans):
    if i < K:
        print(a)
    else:
        break

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int,input().split())
alist = [int(i) for i in input().split()]
blist = [int(i) for i in input().split()]
clist = [int(i) for i in input().split()]


# print(x,y,z,k, alist, blist, clist)

#%%
# x,y,z,k,alist,blist,clist = 2, 2, 2, 8, [4, 6],[1, 5],[3, 8]


#%%
alist.sort()
blist.sort()
clist.sort()
alist = alist[::-1][:k]
blist = blist[::-1][:k]
clist = clist[::-1][:k]

#%%
import itertools




#%%
ans = []
for i in list(itertools.product(alist, blist, clist)):
    ans.append((sum(i)))

ans.sort()
#%%
for i in ans[::-1][:k]:
    print(i)

#%%


Fixed submission:
# https://atcoder.jp/contests/abc123/tasks/abc123_d

def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

X, Y, Z, K = MAP()
A = LIST()
B = LIST()
C = LIST()

# A.sort(reverse=True); B.sort(reverse=True); C.sort(reverse=True)

E = []
for a in A:
    for b in B:
        E.append(a+b)
E.sort(reverse=True)

ans = []

for c in C[:K]:
    for e in E[:K]:
        ans.append(c+e)
ans.sort(reverse=True)

for i, a in enumerate(ans):
    if i < K:
        print(a)
    else:
        break