# frozen_string_literal: true

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

class Node
  attr_accessor :children

  def initialize()
    @children = []
  end

  def push_child(i)
    @children.push(i)
  end
end

nodes = {}
points = {}
N.times do |i|
  nodes[i + 1] = Node.new
  points[i + 1] = 0
end

(N - 1).times do
  a, b = gets.chomp.split(' ').map(&:to_i)
  nodes[a].push_child(b)
end

Q.times do
  p, x = gets.chomp.split(' ').map(&:to_i)
  points[p] += x
end

N.times do |i|
  point = points[i + 1]
  nodes[i + 1].children.each { |c| points[c] += point }
end

puts points.values.join(' ')
