[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let [n;q] = reads int
    let abs = List.init (n - 1) (fun _ -> reads int |> fun [a;b] -> (a, b))
    let pxs = List.init q (fun _ -> reads int |> fun [p;x] -> (p, x))

    let sumpx =
        let a = Array.create (n + 1) 0
        for (p, x) in pxs do
            a.[p] <- a.[p] + x
        a

    let grp =
        let g : int list [] = Array.init (n + 1) (fun _ -> [])
        for (a, b) in abs do
            g.[a] <- b :: g.[a]
        g

    let ans = Array.create (n + 1) 0
    let rec loop p c =
        ans.[c] <- sumpx.[c]
        if p <> 0 then
            ans.[c] <- ans.[c] + ans.[p]
        let cs = grp.[c]
        List.iter (loop c) cs

    loop 0 1

    Array.tail ans
    |> Array.map string
    |> Array.reduce (fun l r -> l + " " + r)
    |> printfn "%s"

    0