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 addPoint(treeRoot, points, qHash, pointSum, rootNum)
  if newPoint = qHash[rootNum]
    pointSum += newPoint
  end

  points[rootNum] = pointSum

  treeRoot[rootNum].each {|child|
    addPoint(treeRoot, points, qHash, pointSum, child)
  }
end

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

qHash = Hash.new(0)
q.times do
  p, x = gets.split.map(&:to_i)
  qHash[p] += x
end

addPoint(treeRoot, points, qHash, 0, 1)

points.shift
puts points.join(' ')
