N, Q = gets.split.map(&:to_i)
edges = Hash.new { |h, k| h[k] = [] }

(N - 1).times do
  a, b = gets.split.map(&:to_i)

  edges[a - 1] << b - 1
  edges[b - 1] << a - 1
end

counter = Array.new(N, 0)

Q.times do
  idx, cnt = gets.split.map(&:to_i)

  counter[idx - 1] += cnt
end

answers = Array.new(N, 0)

queue = [[0, counter[0]]]
visited = Hash.new(false)

until queue.empty?
  idx, cnt = queue.shift

  next if visited[idx]
  visited[idx] = true

  answers[idx] = cnt

  edges[idx].each do |child|
    queue << [child, cnt + counter[child]]
  end
end

puts answers.join(' ')
