N,Q = gets.split.map &:to_i

tree = Array.new(N-2)
1.upto(N-1) do
    a,b = gets.split.map &:to_i
    tree[b] = a
end

counter = Array.new(N+1,0)
1.upto(Q) do |i|
    p,x = gets.split.map &:to_i
    counter[p] += x
end

2.upto(N) do |i|
    counter[i] += counter[tree[i]]
end

puts counter[1..-1].join(" ")