import java.io.PrintWriter

import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    //    val sc = new Scanner(System.in)
    val n, q = Scanner.nextInt()

    val tree = new Array[mutable.Set[Int]](n)

    for (i <- tree.indices) {
      tree(i) = mutable.Set.empty
    }

    val vertex = new Array[Int](n)
    for (_ <- 0 until n - 1) {
      val a, b = Scanner.nextInt()
      tree(a - 1) += b - 1
      tree(b - 1) += a - 1
    }

    for (_ <- 0 until q) {
      val p, x = Scanner.nextInt()
      vertex(p - 1) += x
    }

    val queue = mutable.Queue(0)
    val s = mutable.Set(0)  
    while (queue.nonEmpty) {
      val i = queue.dequeue()
      tree(i).foreach(j => {
        if (!s.contains(j)) {
          vertex(j) += vertex(i)
          queue.enqueue(j)
          s += j
        }
      })
    }

    printArray(vertex)
  }

  def printArray[T](arr: Array[T]): Unit = {
    val pw = new PrintWriter(System.out)

    for (i <- arr.indices) {
      if (i != arr.length - 1) {
        pw.print(s"${arr(i)} ")
      }
    }
    pw.println(arr(arr.length - 1))
    pw.flush()
  }
}


object Scanner {
  private val buf = new Array[Byte](1024);
  private var ptr = 0;
  private var len = 0

  def nextInt(): Int = {
    val n = nextLong()
    if (n < Int.MinValue || Int.MaxValue < n) ???
    n.toInt
  }

  def nextLong(): Long = {
    if (!hasNext()) ???
    var minus = false;
    var b = readByte()
    if (b == '-') {
      minus = true;
      b = readByte()
    }

    def go(b: Byte, n: Long = 0): Long =
      if ('0' <= b && b <= '9') {
        go(readByte(), n * 10 + b - '0')
      }
      else if (minus) {
        -n
      } else {
        n
      }

    go(b)
  }

  @inline private def hasNext(): Boolean = {
    while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
    hasNextByte()
  }

  @inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126

  @inline private def readByte(): Byte =
    if (hasNextByte()) {
      val res = buf(ptr);
      ptr += 1;
      res
    } else {
      -1
    }

  @inline private def hasNextByte(): Boolean =
    if (ptr >= len) {
      ptr = 0;
      len = System.in.read(buf);
      len > 0
    } else {
      true
    }

  def nextDouble(): Double = next.toDouble

  def next(): String = {
    if (!hasNext()) ???
    val sb = new StringBuilder;
    var b = readByte()
    while (isPrintableChar(b)) {
      sb.append(b.toChar);
      b = readByte()
    }
    sb.toString
  }
}