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

children = Array.new(n+1).map{[]}

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

scores = Array.new(n+1).map{0}

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

n.times do |i|
  children[i+1].each do |a|
    score = scores[i+1]
    scores[a] += score
  end
end

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