import Foundation

let main: () = {
    let (N, Q) = listOfInt().toTupple()
    var G = [[Int]](repeating: [Int](), count: N) //mutableList
    var ans = [Int](repeating: 0, count: N)
    repeate(N - 1) { _ in
        let (a, b) = listOfInt(-1).toTupple()
        G[a].append(b)
        G[b].append(a)
    }
    repeate(Q) { _ in
        let (p, x) = listOfInt(-1, 0).toTupple()
        ans[p] += x
    }
    func dfs(_ v: Int, _ p: Int = -1) {
        for u in G[v] {
            if (u == p) {continue}
            ans[u] += ans[v]
            dfs(u, v)
        }
    }
    dfs(0)
    print(ans.joined())
}()

func next() -> String { readLine()! }
func nextInt() -> Int { Int(next())! }
func nextDouble() -> Double { Double(next())! }
func listOfString() -> [String] { next().split(separator: " ").map { String($0) } }
func listOfInt(_ offset: Int = 0) -> [Int] { listOfString().map { Int($0)! + offset } }
func listOfInt(_ offsets: Int ...) -> [Int] { listOfString().enumerated().map { Int($0.element)! + offsets[$0.offset % offsets.count] } }
func listOfDouble(_ offset: Double = 0.0) -> [Double] { listOfString().map { Double($0)! + offset } }
func listOfInt(_ offsets: Double ...) -> [Double] { listOfString().enumerated().map { Double($0.element)! + offsets[$0.offset % offsets.count] } }

extension Array where Element == Int {
    func joined(_ sepatator: String = " ") -> String { self.map { String($0) }.joined(separator: sepatator) }
    func toTupple() -> (Int, Int) { (self[0], self[1]) }
    func toTupple() -> (Int, Int, Int) { (self[0], self[1], self[2]) }
    func toTupple() -> (Int, Int, Int, Int) { (self[0], self[1], self[2], self[3]) }
    func toTupple() -> (Int, Int, Int, Int, Int) { (self[0], self[1], self[2], self[3], self[4]) }
    func toTupple() -> (Int, Int, Int, Int, Int, Int) { (self[0], self[1], self[2], self[3], self[4], self[5]) }
}
extension Array where Element == Double {
    func joined(_ sepatator: String = " ") -> String { self.map { String($0) }.joined(separator: sepatator) }
    func toTupple() -> (Double, Double) { (self[0], self[1]) }
    func toTupple() -> (Double, Double, Double) { (self[0], self[1], self[2]) }
}
extension Array where Element == String {
    func toTupple() -> (Int, Double) { (Int(self[0])!, Double(self[1])!) }
    func toTupple() -> (Int, String) { (Int(self[0])!, self[1]) }
    func toTupple() -> (Int, Int, String) { (Int(self[0])!, Int(self[1])!, self[2]) }
}

func repeate(_ times1: Int, _ action: (Int) -> Void) {
    for index1 in 0 ..< times1 {
        action(index1)
    }
}
func repeate(_ times1: Int, _ times2: Int, _ action: (Int, Int) -> Void) {
    for index1 in 0 ..< times1 {
        for index2 in 0 ..< times2 {
            action(index1, index2)
        }
    }
}
func repeate(_ times1: Int, _ times2: Int, _ times3: Int, _ action: (Int, Int, Int) -> Void) {
    for index1 in 0 ..< times1 {
        for index2 in 0 ..< times2 {
            for index3 in 0 ..< times3 {
                action(index1, index2, index3)
            }
        }
    }
}
func repeate(_ times1: Int, _ times2: Int, _ times3: Int, _ times4: Int, _ action: (Int, Int, Int, Int) -> Void) {
    for index1 in 0 ..< times1 {
        for index2 in 0 ..< times2 {
            for index3 in 0 ..< times3 {
                for index4 in 0 ..< times4 {
                    action(index1, index2, index3, index4)
                }
            }
        }
    }
}

func gcd(_ a: Int, _ b: Int) -> Int { (b > 0) ? gcd(b, a % b) : a }
func lcm(_ a: Int, _ b: Int) -> Int { a / gcd(a, b) * b }
