n,q = gets.split.map(&:to_i)

prev_node = Array.new

(n-1).times do
	a,b = gets.split.map(&:to_i)
	prev_node[b] = a
end

points = Array.new(n+1,0)

q.times do
	p,x = gets.split.map(&:to_i)
	points[p] += x
end

2.upto(n) do |i|
	points[i] += points[prev_node[i]]
end

points.shift

puts points.join(" ")