#![allow(unused_imports)]
#![allow(dead_code)]
#![allow(unused_mut)]
#![allow(non_camel_case_types)]

use crate::rust::library::{util::io::*,graph::paths::*,graph::algorithms::tree_dp::*};
use itertools::*;

// const MOD: u32 = 1_000_000_007;
// const_mod!(P,MOD);

fn main() {
    input!{
        n:usize,
        q:usize,
        v:[(usize1,usize1);n-1],
        que:[(usize1,usize);q],
    }
    let mut a=vec![0;n];
    for (p,x) in que{
        a[p]+=x;
    }
    let mut g=Paths::new(n,v).make_tree_w(a);
    g.propagate(0,|s,t,_|*s+*t);
    let ans=g.get_vertex().iter().map(|x|x.to_string()).collect::<Vec<String>>().join(" ");
    println!("{}",ans);
}




pub mod rust {

pub mod library {

pub mod graph {

pub mod algorithms {

pub mod tree_dp {

pub use crate::rust::library::graph::tree::*;
impl<V,E:std::clone::Clone> Tree<V,E>{
    pub fn propagate<F>(&mut self,st:usize,f:F)where F:Fn(&V,&V,&E)->V{
        self.dfs_propagate(st,self.n,&f)
    }
    fn dfs_propagate<F>(&mut self,now:usize,p:usize,f:&F)where F:Fn(&V,&V,&E)->V{
        for (e,c) in self.g[now].clone(){
            if e == p {continue;}
            self.v[e]=f(&self.v[e],&self.v[now],&c);
            self.dfs_propagate(e,now,f);
        }
    }
    pub fn scan<F>(&mut self,st:usize,f:F)where F:Fn(&V,&V,&E)->V{
        self.dfs_scan(st,self.n,&f);
    }
    fn dfs_scan<F>(&mut self,now:usize,p:usize,f:&F)where F:Fn(&V,&V,&E)->V{
        for (to,c) in self.g[now].clone(){
            if to == p {continue;}
            self.dfs_scan(to,now,f);
            self.v[now]=f(&self.v[now],&self.v[to],&c);
        }
    }
}

}  // mod tree_dp

}  // mod algorithms

pub mod paths {

pub use crate::rust::library::graph::{stable_graph::*,tree::*};
#[deny(invalid_type_param_default)]
pub struct Paths<E:Default=()>{
    n:usize,
    v:Vec<(usize,usize,E)>,
}

impl Paths{
    pub fn new(n:usize,v:Vec<(usize,usize)>)->Self{
        let mut tmp=Vec::<(usize,usize,())>::new();
        for (s,t) in v{
            tmp.push((s,t,()));
        }
        Self{
            n:n,
            v:tmp,
        }
    }
}
impl<E:std::clone::Clone+std::default::Default> Paths<E>{
    pub fn new_w(n:usize,v:Vec<(usize,usize,E)>)->Self{
        Self{
            n:n,
            v:v,
        }
    }
    pub fn make_stable_graph(self)->StableGraph<(),E>{
        let mut ret=StableGraph::<(),E>::new(self.n,vec![();self.n]);
        for (s,t,e) in self.v{
            ret.add_edge(s,t,e);
        }
        ret
    }
    pub fn make_stable_graph_w<T>(self,v:Vec<T>)->StableGraph<T,E>{
        let mut ret=StableGraph::<T,E>::new(self.n,v);
        for (s,t,e) in self.v{
            ret.add_edge(s,t,e);
        }
        ret
    }
    pub fn make_tree(self)->Tree<(),E>{
        let mut ret=Tree::<(),E>::new(self.n,vec![();self.n]);
        for (s,t,e) in self.v{
            ret.add_edge(s,t,e);
        }
        ret
    }
    pub fn make_tree_w<T>(self,v:Vec<T>)->Tree<T,E>{
        let mut ret=Tree::<T,E>::new(self.n,v);
        for (s,t,e) in self.v{
            ret.add_edge(s,t,e);
        }
        ret
    }
}

}  // mod paths

pub mod stable_graph {

use std::collections::VecDeque;

pub struct StableGraph<V,E>{
    n:usize,
    m:usize,
    v:Vec<V>,
    g:Vec<Vec<(usize,E)>>,
}

impl<V,E:std::clone::Clone> StableGraph<V,E>{
    pub fn new(n:usize,v:Vec<V>)->Self{
        Self{
            n:n,m:0,
            v:v,
            g:vec![Vec::<(usize,E)>::new();n],
        }
    }
    pub fn add_edge(&mut self,s:usize,t:usize,e:E){
        self.m+=1;
        self.g[s.clone()].push((t.clone(),e.clone()));
        self.g[t.clone()].push((s.clone(),e.clone()));
    }
    pub fn add_directed_edge(&mut self,s:usize,t:usize,e:E){
        self.g[s.clone()].push((t.clone(),e.clone()));
    }
    pub fn get_vertex(self)->Vec<V>{self.v}
    // pub fn distance_dijkstra(self,start:usize){
    //     let mut dist:Vec<usize>=vec![usize::MAX;self.n];
    // }
    pub fn distance_bfs(&mut self,start:usize)->Vec<usize>{
        let mut dist:Vec<usize>=vec![std::usize::MAX;self.n];
        let mut que:VecDeque<usize>=VecDeque::new();
        que.push_back(start);
        while !que.is_empty(){
            let now=que.pop_front().unwrap();
            for (e,_c) in self.g[now].clone(){
                if dist[e]>dist[now]+1{
                    dist[e]=dist[now]+1;
                    que.push_back(e);
                }
            }
        }
        dist
    }
    pub fn short_route_tree(&mut self,start:usize)->Vec<usize>{
        let mut dist:Vec<usize>=vec![std::usize::MAX;self.n];
        let mut que:VecDeque<usize>=VecDeque::new();
        que.push_back(start);
        while !que.is_empty(){
            let now=que.pop_front().unwrap();
            for (e,_c) in self.g[now].clone(){
                if dist[e]>dist[now]+1{
                    dist[e]=dist[now]+1;
                    que.push_back(e);
                }
            }
        }
        dist
    }
    pub fn minimum_spanning_tree(self){

    }
}

}  // mod stable_graph

pub mod tree {

#[derive(Debug, Clone)]
pub struct Tree<V,E>{
    pub n:usize,
    pub v:Vec<V>,
    pub g:Vec<Vec<(usize,E)>>,
}
impl<V,E:std::clone::Clone> Tree<V,E>{
    pub fn new(n:usize,v:Vec<V>)->Self{
        Self{
            n:n,
            v:v,
            g:vec![Vec::<(usize,E)>::new();n],
        }
    }
    pub fn add_edge(&mut self,s:usize,t:usize,e:E){
        self.g[s.clone()].push((t.clone(),e.clone()));
        self.g[t.clone()].push((s.clone(),e.clone()));
    }
    pub fn get_vertex(self)->Vec<V>{self.v}
}

}  // mod tree

}  // mod graph

pub mod util {

pub mod io {

#[macro_export]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[macro_export] 
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[macro_export] 
macro_rules! read_value {
    ($iter:expr, [tree;$len:expr]) => {
        {
            let mut g:Vec<Vec<usize>>=vec![Vec::new();$len];
            for (s,t) in read_value!($iter,[(usize1,usize1);$len-1]){
                g[s].push(t);
                g[t].push(s);
            }
            g
        }
    };
    ($iter:expr, [graph;$vertex:expr,$edge:expr]) => {
        {
            let mut g:Vec<Vec<usize>>=vec![Vec::new();$vertex];
            for (s,t) in read_value!($iter,[(usize1,usize1);$edge]){
                g[s].push(t);
                g[t].push(s);
            }
            g
        }
    };
    ($iter:expr, [directed;$vertex:expr,$edge:expr]) => {
        {
            let mut g:Vec<Vec<usize>>=vec![Vec::new();$vertex];
            for (s,t) in read_value!($iter,[(usize1,usize1);$edge]){
                g[s].push(t);
            }
            g
        }
    };
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

}  // mod io

}  // mod util

}  // mod library

}  // mod rust



Measured memory_bytes: 44500