N, Q = gets.split.map(&:to_i)
G = Array.new(N + 1){[]}
(N - 1).times do
  a, b = gets.split.map(&:to_i)
  G[a] << b
end
cs = Array.new(N + 1, 0)
Q.times do
  p, x = gets.split.map(&:to_i)
  cs[p] += x
end
(1 ... N).each{|i| G[i].each{|j| cs[j] += cs[i]}}
puts cs.drop(1).join(' ')