n, q = gets.chomp.split(' ').map(&:to_i)
tree = Array.new(n) { [] }
result = Array.new(n, 0)
(n - 1).times do
  a, b = gets.chomp.split(' ').map(&:to_i)
  tree[a - 1].push(b - 1)
  tree[b - 1].push(a - 1)
end
q.times do
  x, p = gets.chomp.split(' ').map(&:to_i)
  result[x - 1] += p
end

queue = [0]
visited = Hash.new(false)
while queue.count > 0 do
  i = queue.shift
  visited[i] = true
  tree[i].each do |j|
    next if visited[j]
    result[j] += result[i]
    visited[j] = true
    queue.push(j)
  end
end
print result.join(' ')