local edge={}
local c={}
local function dfs(i,k)
    if #edge[i]>0 then
        for _,j in pairs(edge[i]) do
            if j~=k then
                c[j]=(c[j] or 0)+(c[i] or 0)
                dfs(j,i)
            end
        end
    end
end

local n,q=io.read("n","n")
for i=1,n-1 do
    local a,b=io.read("n","n")
    if not edge[a] then
        edge[a]={}
    end
    if not edge[b] then
        edge[b]={}
    end
    table.insert(edge[a],b)
    table.insert(edge[b],a)
end

for i=1,q do
    local p,x=io.read("n","n")
    c[p]=(c[p] or 0)+x
end

dfs(1,0)
print(table.concat(c," "))