class Node
    attr_accessor :n, :p, :val
    def initialize(n)
        @n = n
        @p = []
        @val = 0
    end
    def sum
        unless @sum
            @sum = @p.reduce(@val) { |sum, p| sum + p.sum }
            @p = []
        end
        @sum
    end
    def to_s
        self.sum
    end
end

n, q = ARGF.gets.split.map(&:to_i)
nodes = Array.new(n+1) { |m| Node.new(m) }

(n-1).times do
    a, b = ARGF.gets.split.map(&:to_i)
    nodes[b].p << nodes[a]
end
q.times do
    p, x = ARGF.gets.split.map(&:to_i)
    nodes[p].val += x
end

nodes.shift
puts nodes.map(&:to_s).join(' ')
