let scan_int () = Scanf.scanf " %d" (fun x -> x)
let print_array a = 
  let _ = Array.iter (Printf.printf "%d ") a in print_newline()

module Graph :
  sig
    type graph
    type edge = int * int * int
    val init : int -> graph
    val get_size : graph -> int
    val get_edge: graph -> int -> edge list
    val add_edge: graph -> int -> int -> int -> unit
    val add_biedge: graph -> int -> int -> int -> unit
    val dfs_tree: graph -> int -> int -> (edge -> unit) -> unit
    val dfs_rec: graph -> int -> bool array -> (edge -> unit) -> unit
    val dfs: graph -> (edge -> unit) -> unit
  end =
  struct
    type edge = int * int * int (* from, to, dist *)
    type graph = {v: int; e: (edge list) array}
    let init _n = {v = _n; e = Array.make _n []}
    let get_size g = g.v
    let get_edge g u = g.e.(u)
    let add_edge g u v d = g.e.(u) <- (u, v, d) :: g.e.(u)
    let add_biedge g u v d = let _ = add_edge g u v d in add_edge g v u d
    let rec dfs_tree g curr prev func =
      let transit curr prev edge =
        let _, next, _ = edge in
        if next = prev then ()
        else let _ = func edge in dfs_tree g next curr func in
      List.iter (transit curr prev) g.e.(curr)
    let rec dfs_rec g curr visited func =
      let _ = visited.(curr) <- true in
      let transit curr visited edge =
        let _, next, _ = edge in
        if visited.(next) then ()
        else let _ = func edge in dfs_rec g next visited func in
      List.iter (transit curr visited) g.e.(curr)
    let dfs g func = 
      let visited = Array.make g.v false in
      for i = 0 to g.v - 1 do (if visited.(i) = false then dfs_rec g i visited func) done
  end


let make_graph g n =
  for i = 0 to n-2 do
    let a = scan_int() and b = scan_int() in
    Graph.add_biedge g (a-1) (b-1) 1
  done

let input_query q value =
  for i = 0 to q-1 do
    let p = scan_int() and x = scan_int() in
    value.(p-1) <- value.(p-1) + x
  done

let propagate value edge = let u, v, d = edge in value.(v) <- value.(u) + value.(v)


let () =
  let n = scan_int() and q = scan_int() in
  let g = Graph.init n in
  let _ = make_graph g n in
  let value = Array.make n 0 in
  let _ = input_query q value in
  let _ = Graph.dfs_tree g 0 n (propagate value) in
  print_array value