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

t = Array.new(n) { [] }
(n-1).times do
  a, b = gets.split.map { |i| i.to_i - 1 }
  t[a] << b
  t[b] << a
end

c = Array.new(n) { 0 }
q.times do
  p, x = gets.split.map(&:to_i)
  c[p-1] += x
end

walk = ->i, p {
  t[i].each do |j|
    next if j == p
    c[j] += c[i]
    walk.(j, i)
  end
}
walk.(0, -1)

puts c.join(" ")