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

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

visited = Array.new(n + 1)
dfs = ->(v) {
  visited[v] = true
  tree[v].each do |c|
    next if visited[c]
    total[c] += total[v]
    dfs.(c)
  end
}
dfs.(1)

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