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

parents = Array.new(N + 1)

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

scores = Array.new(N + 1, 0)

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

ans = []
1.upto(N) do |i|
  current = i
  score = scores[current]
  while current = parents[current]
    score += scores[current]
  end
  ans << score
end

puts ans.join(' ')