class Leaf
  attr_reader :number, :value, :parent, :children
  def initialize(number, parent)
    @number = number
    @value = 0
    @parent = parent
    @children = []
  end

  def parent?(n)
    @parent&.number == n
  end

  def add_child(child)
    @children << child
  end

  def add(x)
    @value += x
    children.each do |c|
      c&.add(x)
    end
  end
end

inputs = readlines

n, q = inputs[0].split(' ').map(&:to_i)

leaves = []
(1..n-1).each do |i|
  a, b = inputs[i].split(' ').map(&:to_i)
  parent_leaf = leaves.find {|l| l.number == a || l.number == b }
  if parent_leaf == nil
    leaf = Leaf.new(a, nil)
    leaves << leaf
    parent_leaf = leaves.find {|l| l.number == a || l.number == b }
  end

  if parent_leaf.number == a
    leaf = Leaf.new(b, parent_leaf)
  else
    leaf = Leaf.new(a, parent_leaf)
  end

  leaves << leaf
  parent_leaf.add_child(leaf)
end

pxs = []
(n..q+n-1).each do |i|
  pxs << inputs[i].split(' ').map(&:to_i)
end

def solve(leaves, pxs)
  pxs.each do |px|
    p = px[0]
    x = px[1]
    target_leaf = leaves.find {|l| l.number == p }
    target_leaf.add(x)
  end
  leaves.map(&:value).join(' ')
end

puts solve(leaves, pxs)
