[<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 [] = Array.init (n + 1) (fun _ -> -1)
        for (a, b) in abs do
            g.[b] <- a
        g

    let ans = Array.create (n + 1) None
    let rec loop i =
        if i = 1 then
            ans.[i] <- Some sumpx.[i]
        else
            let p = grp.[i]
            match ans.[p] with
            | Some x -> ans.[i] <- Some (x + sumpx.[i])
            | None ->
                loop p
                let (Some px) = ans.[p]
                ans.[i] <- Some (px + sumpx.[i])

    for i = 1 to n do loop i

    let f = function
        | None -> 0
        | Some x -> x

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

    0