class Tree
  @@nodes = {}
  def self.root
    @@nodes[1]
  end
  def self.make!
    self.root.make(nil)
    visited = [self.root]
    visited.each do |parent|
      parent.children.each do |child|
        child.make(parent)
        visited.push(child)
      end
    end
  end
  def self.node(id)
    @@nodes[id]
  end
  def self.make_count!
    visited = [self.root]
    visited.each do |parent|
      parent.children.each do |child|
        child.plus(parent.count)
        visited.push(child)
      end
    end
  end
  attr_reader :id, :edges, :children, :count
  def initialize(id)
    @id = id
    @parent = nil
    @children = []
    @edges = []
    @count = 0
    @@nodes[id] = self
  end
  def add(id)
    @edges.push(Tree.node(id))
  end
  def plus(count)
    @count += count
    # puts "#{@id}: +#{count}"
  end
  def make(parent)
    @parent = parent
    @edges.delete(parent)
    @children = @edges
  end
end

N,Q = gets.split.map(&:to_i)
(1..N).each{|i| Tree.new(i)}

(N-1).times do
  a,b = gets.split.map(&:to_i)
  Tree.node(a).add(b)
  Tree.node(b).add(a)
end
Tree.make!

Q.times do
  p,x = gets.split.map(&:to_i)
  Tree.node(p).plus(x)
end
Tree.make_count!

(1..N).each do |i|
  print "#{Tree.node(i).count} "
end
puts