local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) assert(type(default_val) ~= 'table') local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
----
local N, Q = read.nn()
local edges = {}
for i=1,N do
    edges[i] = {}
end
for i=1,N-1 do
    local a, b = read.nn()
    table.insert(edges[a], b)
    table.insert(edges[b], a)
end
local q = array(1, 0)
for i=1,Q do
    local p, x = read.nn()
    q[p] = q[p] + x
end

local C = {}
for i=1,N do
    C[i] = 0
end
local function dfs_cps(node, prev, accum, cont)
    accum = accum + q[node]
    C[node] = accum
    local adjs = edges[node]
    local function make_cont(j)
        return function()
            local next = adjs[j]
            if next then
                if next ~= prev then
                    return dfs_cps(next, node, accum, make_cont(j+1))
                else
                    return make_cont(j+1)()
                end
            else
                return cont()
            end
        end
    end
    return make_cont(1)()
end
dfs_cps(1, -1, 0, function()
    print(table.concat(C, ' '))
end)