-- D
local N, Q = io.read("n", "n")
local children = {}
for i=1,N do
    children[i] = {}
end
for i=1,N-1 do
    local a, b = io.read("n", "n")
    table.insert(children[a], b)
end

local q = {}
for i=1,N do
    q[i] = 0
end
for i=1,Q do
    local p, x = io.read("n", "n")
    q[p] = q[p] + x
end

local counters = {}
for i=1,N do
    counters[i] = 0
end
local function dfs(node, accum)
    local inc = q[node]
    counters[node] = accum + inc
    for k, child in ipairs(children[node]) do
        dfs(child, accum + inc)
    end
end

dfs(1, 0)

print(table.concat(counters, " "))
