stdin.ReadLine()
|> fun x -> x.Split(' ') |> Array.map int |> fun x -> (x.[0], x.[1])
|> fun (n, q) ->
  (
    [1..(n - 1)] |> List.map (fun _ -> stdin.ReadLine() |> fun x -> x.Split(' ') |> Array.map int |> fun x -> (x.[0], x.[1])),
    [1..q]       |> List.map (fun _ -> stdin.ReadLine() |> fun x -> x.Split(' ') |> Array.map int |> fun x -> (x.[0], x.[1]))
  )
  |> fun (es, ps) ->
    (
      es
      |> List.fold (
        fun map (a, b) ->
          map
          |> Map.tryFind a
          |> fun t ->
            match t with
            | Some cs -> map.Remove(a).Add(a, b::cs)
            | None -> map.Add(a, [b])
      ) Map.empty,
      ps
      |> List.fold (
        fun map (p, x) ->
          map
          |> Map.tryFind p
          |> fun t ->
            match t with
            | Some y -> map.Remove(p).Add(p, x + y)
            | None -> map.Add(p, x)
      ) Map.empty
      |> Map.toList
    )
  |> fun (pcs, ps) ->
    ps
    |> List.fold (
      fun (arr: int64 array) (p, x) ->
        ([| [p] |])
        |> fun (stack: int list array) ->
          Seq.initInfinite (
            fun _ ->
              match stack.[0] with
              | [] -> ()
              | i::ts ->
                (arr.[i] <- arr.[i] + int64 x)
                |> fun () ->
                  stack.[0] <-
                    (
                      pcs
                      |> Map.tryFind i
                      |> fun cs ->
                        match cs with
                        | Some cs -> cs @ ts
                        | None -> ts
                    )
          )
          |> Seq.takeWhile (fun _ -> stack.[0] |> List.isEmpty |> not)
          |> Seq.toArray
          |> fun _ -> arr
    ) (Array.zeroCreate (n + 1))
|> fun arr ->
  arr
  |> Array.skip 1
  |> Array.map string
  |> String.concat " "
|> printfn "%s"
