class Tree
  attr_accessor(:next, :param)

  def initialize()
    @next = []
    @param = 0
  end

  def next()
    @next
  end

  def param()
    @param
  end

  def setnext(x)
    @next.push(x)
  end

  def plus(x)
    @param += x
  end

end

n,q = gets.chomp.split(" ").map(&:to_i)
tree = Array.new(n).map{Tree.new}
(n-1).times do |i|
  a,b = gets.chomp.split(" ").map(&:to_i)
  tree[a-1].setnext(b-1)
  tree[b-1].setnext(a-1)
end
q.times do |i|
  p,x = gets.chomp.split(" ").map(&:to_i)
  tree[p-1].plus(x)
end

visited = []
queue1 = [0]
while !queue1.empty?
  v1 = queue1[0]
  queue1.shift
  visited.push(v1)
  tree[v1].next.each do |x|
    queue1.push(x) if !visited.include?(x)
  end
  queue2 = tree[v1].next
  param = tree[v1].param
  while !queue2.empty?
    v2 = queue2[0]
    queue2.shift
    tree[v2].plus(param) if !visited.include?(v2)
  end
  print "#{tree[v1].param} "
end