local DBG = true
local function dbgpr(...)
    if DBG then
        io.write("[dbg]")
        print(...)
    end
end

local function dbgpr_t(tbl, use_pairs)
    if DBG then
        local enum = ipairs
        if use_pairs then
            enum = pairs
        end
        dbgpr(tbl)
        io.write("[dbg]")
        for i,v in enum(tbl) do
            io.write(i)
            io.write(":")
            io.write(tostring(v))
            io.write(" ")
        end
        print("")
    end
end

local function dbgpr_tp(tbl)
    dbgpr_t(tbl, true)
end

-- D
local X, Y, Z, K = io.read("n", "n", "n", "n")
local A, B, C = {}, {}, {}

for i, tbl in ipairs {A, B, C} do
    local nums = {X, Y, Z}
    local count = nums[i]
    for j=1, count do
        tbl[j] = io.read("n")
    end
    table.sort(tbl, function (x,y)
        return x > y
    end)
end

local function goodness(a, b, c)
    if a > #A or b > #B or c > #C then
        return -10000000000000
    end
    return A[a] + B[b] + C[c]
end

local visited = {}
local function visit(a,b,c)
    visited[tostring(a) .. "*" .. tostring(b) .. "*" .. tostring(c)] = true
end
local function isvisited(a,b,c)
    return visited[tostring(a) .. "*" .. tostring(b) .. "*" .. tostring(c)]
end

-- most good comb right
local items = {}
local function item_sort(tbl)
    table.sort(items, function(x,y)
        return x[4] < y[4]
    end)
end
local function items_count()
    return #items
end
local function items_add(a, b, c)
    if items_count() > 3000 then
        if items[#items][4] >= goodness(a,b,c) then
            return false
        end
    end
    table.insert(items, {a,b,c,goodness(a,b,c)})
    item_sort(items)
    return true
end
local function check_add(a,b,c)
    if a > #A or b > #B or c > #C then
        return -1
    end
    if isvisited(a, b, c) then
        return -2
    end
    visit(a,b,c)
    items_add(a, b, c)
end
local ans = {}
local a, b, c = 1, 1, 1
check_add(a, b, c)
while #ans < K do
    local e = table.remove(items)
    table.insert(ans, e[4])
    local a,b,c = e[1], e[2], e[3]
    check_add(a+1,b,c)
    check_add(a,b+1,c)
    check_add(a,b,c+1)
end

--table.sort(ans, function(x,y) return x>y end)
for i=1,K do
    print(ans[i])
end

