Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = map(int,input().split())
ax = [int(_) for _ in input().split()]
ay = [int(_) for _ in input().split()]
az = [int(_) for _ in input().split()]
ax.sort(reverse=True)
ay.sort(reverse=True)
az.sort(reverse=True)
INF = - 3 *10 ** 10
ax.extend([INF])
ay.extend([INF])
az.extend([INF])
l = [(ax[0]+ay[0]+az[0],0,0,0)]
for i in range(k):
    t = l.pop(0)
    print(t[0])
    if (ax[t[1]+1]+ay[t[2]]+az[t[3]],t[1]+1,t[2],t[3]) not in l:
        l.append((ax[t[1]+1]+ay[t[2]]+az[t[3]],t[1]+1,t[2],t[3]))
    if (ax[t[1]]+ay[t[2]+1]+az[t[3]],t[1],t[2]+1,t[3]) not in l:
        l.append((ax[t[1]]+ay[t[2]+1]+az[t[3]],t[1],t[2]+1,t[3]))    
    if (ax[t[1]]+ay[t[2]]+az[t[3]+1],t[1],t[2],t[3]+1) not in l:
        l.append((ax[t[1]]+ay[t[2]]+az[t[3]+1],t[1],t[2],t[3]+1))
    l.sort(key=lambda x:(-x[0],x[1],x[2],x[3]))

Fixed submission:
import heapq
x,y,z,k = map(int,input().split())
ax = [int(_) for _ in input().split()]
ay = [int(_) for _ in input().split()]
az = [int(_) for _ in input().split()]
ax.sort(reverse=True)
ay.sort(reverse=True)
az.sort(reverse=True)
INF = - 3 *10 ** 10
ax.extend([INF])
ay.extend([INF])
az.extend([INF])
l = [(-(ax[0]+ay[0]+az[0]),0,0,0)]
checked = {(-(ax[0]+ay[0]+az[0]),0,0,0)}
for i in range(k):
    t = heapq.heappop(l)
    print(-t[0])
    if (-(ax[t[1]+1]+ay[t[2]]+az[t[3]]),t[1]+1,t[2],t[3]) not in checked:
        heapq.heappush(l,(-(ax[t[1]+1]+ay[t[2]]+az[t[3]]),t[1]+1,t[2],t[3])) 
        checked.add((-(ax[t[1]+1]+ay[t[2]]+az[t[3]]),t[1]+1,t[2],t[3]))
    if (-(ax[t[1]]+ay[t[2]+1]+az[t[3]]),t[1],t[2]+1,t[3]) not in checked:
        heapq.heappush(l,(-(ax[t[1]]+ay[t[2]+1]+az[t[3]]),t[1],t[2]+1,t[3]))
        checked.add((-(ax[t[1]]+ay[t[2]+1]+az[t[3]]),t[1],t[2]+1,t[3]))
    if (-(ax[t[1]]+ay[t[2]]+az[t[3]+1]),t[1],t[2],t[3]+1) not in checked:
        heapq.heappush(l,(-(ax[t[1]]+ay[t[2]]+az[t[3]+1]),t[1],t[2],t[3]+1))
        checked.add((-(ax[t[1]]+ay[t[2]]+az[t[3]+1]),t[1],t[2],t[3]+1))

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = map(int,input().split())
ax = [int(_) for _ in input().split()]
ay = [int(_) for _ in input().split()]
az = [int(_) for _ in input().split()]
ax.sort(reverse=True)
ay.sort(reverse=True)
az.sort(reverse=True)
INF = - 3 *10 ** 10
ax.extend([INF]*k)
ay.extend([INF]*k)
az.extend([INF]*k)
l = [(ax[0]+ay[0]+az[0],0,0,0)]
for i in range(k):
    t = l.pop(0)
    print(t[0])
    if (ax[t[1]+1]+ay[t[2]]+az[t[3]],t[1]+1,t[2],t[3]) not in l:
        l.append((ax[t[1]+1]+ay[t[2]]+az[t[3]],t[1]+1,t[2],t[3]))
    if (ax[t[1]]+ay[t[2]+1]+az[t[3]],t[1],t[2]+1,t[3]) not in l:
        l.append((ax[t[1]]+ay[t[2]+1]+az[t[3]],t[1],t[2]+1,t[3]))    
    if (ax[t[1]]+ay[t[2]]+az[t[3]+1],t[1],t[2],t[3]+1) not in l:
        l.append((ax[t[1]]+ay[t[2]]+az[t[3]+1],t[1],t[2],t[3]+1))
    l.sort(key=lambda x:(-x[0],x[1],x[2],x[3]))

Fixed submission:
import heapq
x,y,z,k = map(int,input().split())
ax = [int(_) for _ in input().split()]
ay = [int(_) for _ in input().split()]
az = [int(_) for _ in input().split()]
ax.sort(reverse=True)
ay.sort(reverse=True)
az.sort(reverse=True)
INF = - 3 *10 ** 10
ax.extend([INF])
ay.extend([INF])
az.extend([INF])
l = [(-(ax[0]+ay[0]+az[0]),0,0,0)]
checked = {(-(ax[0]+ay[0]+az[0]),0,0,0)}
for i in range(k):
    t = heapq.heappop(l)
    print(-t[0])
    if (-(ax[t[1]+1]+ay[t[2]]+az[t[3]]),t[1]+1,t[2],t[3]) not in checked:
        heapq.heappush(l,(-(ax[t[1]+1]+ay[t[2]]+az[t[3]]),t[1]+1,t[2],t[3])) 
        checked.add((-(ax[t[1]+1]+ay[t[2]]+az[t[3]]),t[1]+1,t[2],t[3]))
    if (-(ax[t[1]]+ay[t[2]+1]+az[t[3]]),t[1],t[2]+1,t[3]) not in checked:
        heapq.heappush(l,(-(ax[t[1]]+ay[t[2]+1]+az[t[3]]),t[1],t[2]+1,t[3]))
        checked.add((-(ax[t[1]]+ay[t[2]+1]+az[t[3]]),t[1],t[2]+1,t[3]))
    if (-(ax[t[1]]+ay[t[2]]+az[t[3]+1]),t[1],t[2],t[3]+1) not in checked:
        heapq.heappush(l,(-(ax[t[1]]+ay[t[2]]+az[t[3]+1]),t[1],t[2],t[3]+1))
        checked.add((-(ax[t[1]]+ay[t[2]]+az[t[3]+1]),t[1],t[2],t[3]+1))