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

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

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

scores = Array.new(N, 0)

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

queue = [1]
while queue.size > 0
  node = queue.pop
  children[node].each do |child|
    scores[child-1] += scores[node-1]
    queue << child
  end
end

puts scores.join(' ')