n, q = gets.split.map(&:to_i)
h = Hash.new(){|hash, key| hash[key] = []}
(n-1).times{
  a, b = gets.split.map(&:to_i)
  h[a] << b
  h.each do |i|
    f = i.shift
    if i.flatten.include?(a)
      h[f] << b
    end
  end
}
ans = Array.new(n, 0)
q.times{
  x, y = gets.split.map(&:to_i)
  ans[x-1] += y
  h[x].each do |i|
    ans[i-1] += y
  end
}
puts ans.join(" ")