n,q = gets.chomp.split(" ").map(&:to_i)
point = Array.new(n,0)
edge = Array.new(n).map{Array.new}
counter = Array.new(n,-1)

for i in 1..n-1 do
    a,b = gets.chomp.split(" ").map(&:to_i)
    edge[a-1].push(b)
    edge[b-1].push(a)
end

for i in 1..q do
    p0,x = gets.chomp.split(" ").map(&:to_i)
    point[p0-1] += x
end

stack = [[1,0]]
while ! stack.empty?
    tar = stack.shift
    i = tar[0]-1
    cnt = tar[1] + point[i]
    if counter[i] < 0
        counter[i] = cnt
        while ! edge[i].empty?
            nxt = edge[i].shift
            if counter[nxt-1] < 0
                stack.push([nxt,cnt])
            end
        end
    end
end

for i in 1..n do
    print counter[i-1]," "
end
print "\n"
    