X, Y, Z, K = list(map(int, input().split()))

A = list(map(int, input().split()))

B = list(map(int, input().split()))

C = list(map(int, input().split()))



A = sorted(A)[::-1]

B = sorted(B)[::-1]

C = sorted(C)[::-1]



import bisect, heapq



def myidx(x, y, z, X, Y, Z): return(x * (Y * X) + y * Z + z)



ans = 0

cnt = 0

score = A[0] + B[0] + C[0]

history = []

q = [(0, 0, 0, 0)]

while len(q) > 0:

    penalty, x, y, z = heapq.heappop(q)

    # print("#", penalty, x, y, z, history)

    if x < X - 1:

        idx_tmp = myidx(x + 1, y, z, X, Y, Z)

        if idx_tmp not in history:

            # print("##", x + 1, y, z)

            heapq.heappush(history, idx_tmp)

            #

            penalty_tmp = penalty + (A[x] - A[x + 1])

            heapq.heappush(q, (penalty_tmp, x + 1, y, z))

    if y < Y - 1:

        idx_tmp = myidx(x, y + 1, z, X, Y, Z)

        if idx_tmp not in history:

            # print("##", x, y + 1, z)

            heapq.heappush(history, idx_tmp)

            #

            penalty_tmp = penalty + (B[y] - B[y + 1])

            heapq.heappush(q, (penalty_tmp, x, y + 1, z))

    if z < Z - 1:

        idx_tmp = myidx(x, y, z + 1, X, Y, Z)

        if idx_tmp not in history:

            # print("##", x, y, z + 1)

            heapq.heappush(history, idx_tmp)

            #

            penalty_tmp = penalty + (C[z] - C[z + 1])

            heapq.heappush(q, (penalty_tmp, x, y, z + 1))

    #

    cnt += 1

    print((score - penalty))

    if cnt == K:

        break
X, Y, Z, K = list(map(int, input().split()))

A = list(map(int, input().split()))

B = list(map(int, input().split()))

C = list(map(int, input().split()))



A = sorted(A)[::-1]

B = sorted(B)[::-1]

C = sorted(C)[::-1]



import bisect, heapq



def myidx(x, y, z, X, Y, Z): return(x * (Y * X) + y * Z + z)



ans = 0

cnt = 0

score = A[0] + B[0] + C[0]

history = {}

q = [(0, 0, 0, 0)]

while len(q) > 0:

    penalty, x, y, z = heapq.heappop(q)

    # print("#", penalty, x, y, z, history)

    if x < X - 1:

        idx_tmp = myidx(x + 1, y, z, X, Y, Z)

        if history.setdefault(str(idx_tmp), 0) == 0:

            # print("##", x + 1, y, z)

            history[str(idx_tmp)] = 1

            #

            penalty_tmp = penalty + (A[x] - A[x + 1])

            heapq.heappush(q, (penalty_tmp, x + 1, y, z))

    if y < Y - 1:

        idx_tmp = myidx(x, y + 1, z, X, Y, Z)

        if history.setdefault(str(idx_tmp), 0) == 0:

            # print("##", x, y + 1, z)

            history[str(idx_tmp)] = 1

            #

            penalty_tmp = penalty + (B[y] - B[y + 1])

            heapq.heappush(q, (penalty_tmp, x, y + 1, z))

    if z < Z - 1:

        idx_tmp = myidx(x, y, z + 1, X, Y, Z)

        if history.setdefault(str(idx_tmp), 0) == 0:

            # print("##", x, y, z + 1)

            history[str(idx_tmp)] = 1

            #

            penalty_tmp = penalty + (C[z] - C[z + 1])

            heapq.heappush(q, (penalty_tmp, x, y, z + 1))

    #

    cnt += 1

    print((score - penalty))

    if cnt == K:

        break
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = sorted(A)[::-1]
B = sorted(B)[::-1]
C = sorted(C)[::-1]
import bisect, heapq


def myidx(x, y, z, X, Y, Z):
    return x * (Y * X) + y * Z + z


ans = 0
cnt = 0
score = A[0] + B[0] + C[0]
history = []
q = [(0, 0, 0, 0)]
while len(q) > 0:
    penalty, x, y, z = heapq.heappop(q)
    # print("#", penalty, x, y, z, history)
    if x < X - 1:
        idx_tmp = myidx(x + 1, y, z, X, Y, Z)
        if idx_tmp not in history:
            # print("##", x + 1, y, z)
            heapq.heappush(history, idx_tmp)
            #
            penalty_tmp = penalty + (A[x] - A[x + 1])
            heapq.heappush(q, (penalty_tmp, x + 1, y, z))
    if y < Y - 1:
        idx_tmp = myidx(x, y + 1, z, X, Y, Z)
        if idx_tmp not in history:
            # print("##", x, y + 1, z)
            heapq.heappush(history, idx_tmp)
            #
            penalty_tmp = penalty + (B[y] - B[y + 1])
            heapq.heappush(q, (penalty_tmp, x, y + 1, z))
    if z < Z - 1:
        idx_tmp = myidx(x, y, z + 1, X, Y, Z)
        if idx_tmp not in history:
            # print("##", x, y, z + 1)
            heapq.heappush(history, idx_tmp)
            #
            penalty_tmp = penalty + (C[z] - C[z + 1])
            heapq.heappush(q, (penalty_tmp, x, y, z + 1))
    #
    cnt += 1
    print((score - penalty))
    if cnt == K:
        break

X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = sorted(A)[::-1]
B = sorted(B)[::-1]
C = sorted(C)[::-1]
import bisect, heapq


def myidx(x, y, z, X, Y, Z):
    return x * (Y * X) + y * Z + z


ans = 0
cnt = 0
score = A[0] + B[0] + C[0]
history = {}
q = [(0, 0, 0, 0)]
while len(q) > 0:
    penalty, x, y, z = heapq.heappop(q)
    # print("#", penalty, x, y, z, history)
    if x < X - 1:
        idx_tmp = myidx(x + 1, y, z, X, Y, Z)
        if history.setdefault(str(idx_tmp), 0) == 0:
            # print("##", x + 1, y, z)
            history[str(idx_tmp)] = 1
            #
            penalty_tmp = penalty + (A[x] - A[x + 1])
            heapq.heappush(q, (penalty_tmp, x + 1, y, z))
    if y < Y - 1:
        idx_tmp = myidx(x, y + 1, z, X, Y, Z)
        if history.setdefault(str(idx_tmp), 0) == 0:
            # print("##", x, y + 1, z)
            history[str(idx_tmp)] = 1
            #
            penalty_tmp = penalty + (B[y] - B[y + 1])
            heapq.heappush(q, (penalty_tmp, x, y + 1, z))
    if z < Z - 1:
        idx_tmp = myidx(x, y, z + 1, X, Y, Z)
        if history.setdefault(str(idx_tmp), 0) == 0:
            # print("##", x, y, z + 1)
            history[str(idx_tmp)] = 1
            #
            penalty_tmp = penalty + (C[z] - C[z + 1])
            heapq.heappush(q, (penalty_tmp, x, y, z + 1))
    #
    cnt += 1
    print((score - penalty))
    if cnt == K:
        break

-history = [] +history = {} -        if idx_tmp not in history: +        if history.setdefault(str(idx_tmp), 0) == 0: -            heapq.heappush(history, idx_tmp) +            history[str(idx_tmp)] = 1 -        if idx_tmp not in history: +        if history.setdefault(str(idx_tmp), 0) == 0: -            heapq.heappush(history, idx_tmp) +            history[str(idx_tmp)] = 1 -        if idx_tmp not in history: +        if history.setdefault(str(idx_tmp), 0) == 0: -            heapq.heappush(history, idx_tmp) +            history[str(idx_tmp)] = 1