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

edge = Hash.new{ |h, k| h[k] = [] }
(n-1).times do
  a, b = gets.chomp.split.map(&:to_i)
  edge[a] << b
  edge[b] << a
end

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

done = []
queue = [[1, 0]]
while elem = queue.shift do
  node, p_val = elem
  done[node] = true
  val[node] += p_val
  edge[node].each do |nextnode|
    next if done[nextnode]
    queue.push([nextnode,val[node]])
  end
end

puts(val[1..n].join(" "))