n, q = gets.split.map(&:to_i)

treeRoot = Hash.new {|hash, key| hash[key] = []}
points = Array.new(n, 0)

def addTree(treeRoot, parentNum, childNum)
  treeRoot[parentNum] << childNum
end

def getChilds(treeRoot, rootNum)
  childs = [rootNum]
  treeRoot[rootNum].each {|child|
    if childs2 = getChilds(treeRoot, child)
      childs = [childs, childs2].flatten!
    end
  }
  childs
end

(n - 1).times do
  a, b = gets.split.map(&:to_i)
  addTree(treeRoot, a, b)
end

q.times do
  p, x = gets.split.map(&:to_i)
  getChilds(treeRoot, p).each {|toPointCHild|
    points[toPointCHild - 1] += x
  }
end

puts points.join(' ')
