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

tree_c = {}
answers = []

(n - 1).times do |_|
  a, b = gets.split(" ").map(&:to_i)
  tree_c[a] = { p: nil, v: 0 } unless tree_c.key?(a)
  tree_c[b] = { p: a, v: 0 } unless tree_c.key?(b)
end

q.times do |_|
  a, b = gets.split(" ").map(&:to_i)
  tree_c[a][:v] += b
end

tree_v = {}
tree_c.keys.sort_by { |v| v }.each do |k|
  p = tree_c[k][:p]
  v = tree_c[k][:v] + (tree_v[p] || 0)
  tree_v[k] = 0 unless tree_v.key?(k)
  tree_v[k] += v
  answers.push(v)
end

puts answers.join(" ")
