N, Q = gets.chomp.split.map(&:to_i)

$tree = Hash.new{ |h,k| h[k] = [] }

(N-1).times do |i|
  a, b = gets.chomp.split.map(&:to_i)
  # a < bなので片方だけ入れる
  $tree[a] << b
end


# クエリに順番は関係ない
# 1つの頂点に対してのものはまとめて良い
$query = Hash.new(0)

Q.times do |i|
  p, x = gets.chomp.split.map(&:to_i)
  $query[p] += x
end


$ans = Array.new(0)

def dfs(vertex, score)
  return if $tree[vertex].empty?
  
  $tree[vertex].each do |v|
    $ans[v-1] = score + $query[v]
    dfs(v, score+$query[v])
  end
end


$ans[0] = $query[1]
dfs(1, $query[1])

puts $ans.join(' ')



