require "set"

class Tree
  attr_reader :nodes

  def initialize
    @nodes = {}
  end

  def add_node(id)
    @nodes[id] ||= Node.new(id)
  end

  def add_edge(id1, id2)
    @nodes[id1].add_edge(id2)
    @nodes[id2].add_edge(id1)
  end

  # Depth First Search : 深さ優先探索
  def add_value_dfs(root_id, value)
    visited = Set.new([root_id])
    stack = [root_id]
    while !stack.empty?
      n_id = stack.pop
      n = @nodes[n_id]
      n.add_value(value)
      n.linkded_edges.each do |on_id|
        next if visited.include?(on_id) || n.depth >= @nodes[on_id].depth
        visited << on_id
        stack.push(on_id)
      end
    end
  end

  def set_depth_dfs(root_id)
    visited = Set.new([root_id])
    @nodes[root_id].depth = 0
    stack = [root_id]
    while !stack.empty?
      n_id = stack.pop
      n = @nodes[n_id]
      n.linkded_edges.each do |on_id|
        next if visited.include?(on_id)
        visited << on_id
        @nodes[on_id].depth = @nodes[n_id].depth + 1
        stack.push(on_id)
      end
    end
  end

  class Node
    attr_reader :id, :value, :linkded_edges
    attr_accessor :depth
    def initialize(id)
      @id = id
      @value = 0
      @depth = nil
      @linkded_edges = Set.new
    end

    def add_edge(other_node_id)
      @linkded_edges << other_node_id
    end

    def add_value(value)
      @value += value
    end
  end
end

tree = Tree.new

N, Q = gets.chomp.split(" ").map(&:to_i)
A = []
B = []
P = []
X = []
(N-1).times do |i|
  a, b = gets.chomp.split(" ").map(&:to_i)
  tree.add_node(a)
  tree.add_node(b)
  tree.add_edge(a, b)
end
tree.set_depth_dfs(1)

Q.times do |i|
  p, x = gets.chomp.split(" ").map(&:to_i)
  tree.add_value_dfs(p, x)
end

puts (1..N).map {|i| tree.nodes[i].value }.join(" ")
