N, Q = gets.split.map!(&:to_i)

relation = Array.new(N+1).map!{[]}
(N-1).times do
    a,b = gets.split.map!(&:to_i)
    relation[a] << b
    relation[b] << a
end

ans = Array.new(N+1,0)
Q.times do
    q,x = gets.split.map!(&:to_i)
    ans[q] += x
end

queue = [1]
visit = Array.new(N+1,false)
    
until queue.empty? do
    current = queue.shift
    visit[current] = true

    relation[current].each do |next_node|
        unless visit[next_node] then 
            queue << next_node
            ans[next_node] += ans[current]
        end
    end
end

puts ans[1..N].join(' ')