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

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

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


que = [[1, 0]]
ans = []
until que.empty?
  node, count = que.shift
  ans[node] = count + qi[node]
  ab[node].each do |child|
    que.push [child, count + qi[node]]
  end
end

puts ans[1..-1].join(' ')
