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

edges = Array.new(N) {[]}

(N-1).times do
  a, b = gets.split.map(&:to_i)
  edges[a-1] << b - 1
end

ans = Array.new(N) {0}

Q.times do
  p, x = gets.split.map(&:to_i)
  ans[p-1] += x
end

def dfs(u, p, edges, ans)
  edges[u].each do |v|
    next if p == v
    ans[v] += ans[u]
    dfs(v, u, edges, ans)
  end
end

dfs(0, -1, edges, ans)

puts ans.join(' ')
