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

use crate::rust::library::{util::io::*,math::mod_int::*,graph::paths::*};
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 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>{
    n:usize,
    v:Vec<V>,
    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}
    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

}  // mod graph

pub mod math {

pub mod mod_int {

use std::ops::{Add,AddAssign,Sub,SubAssign,Mul,MulAssign,Div,DivAssign,Neg};
use std::str::FromStr;
use std::num::ParseIntError;
use std::iter::{Sum,Product};

pub fn inv_mod(a:u64,m:u64)->u64{
    let m=m as i64;
    let mut a=a as i64;
    let mut b=m as i64;
    let mut u=1i64;
    let mut v=0i64;
    while b>0 {
        let t=a/b;
        a-=t*b;
        u-=t*v;
        std::mem::swap(&mut a,&mut b);
        std::mem::swap(&mut u,&mut v);
    }
    let ans =(if u>=0{u%m}else{m+(u%m)%m})as u64;
    ans
}

pub trait Mod:Sized{
    fn m()->u32;
    fn m64()->u64;
    fn mi64()->i64;
}
#[macro_export]
macro_rules! const_mod{
    ($st:ident,$m:expr)=>{
        struct $st{}
        impl Mod for $st {
            fn m()->u32{$m}
            fn m64()->u64{$m as u64}
            fn mi64()->i64{$m as i64}
        }
        //const MAX=10000000;
        type Fp=ModInt<P>;
        //const fact_table:[Fp;MAX]=(0..MAX)
    }
}
pub struct ModInt<M:Mod>{a:u32,_p:std::marker::PhantomData<M>}

impl<M: Mod> ModInt<M>{
    pub fn new(a:u32)->Self{
        ModInt{a,_p:std::marker::PhantomData}
    }
    pub fn newu64(a:u64)->Self{
        ModInt{a:(a%M::m64())as u32,_p:std::marker::PhantomData}
    }
    pub fn newi64(a:i64)->Self{
        ModInt{a:((a%M::mi64()+M::mi64())%M::mi64()) as u32,_p:std::marker::PhantomData}
    }
    pub fn value(&self)->u32{self.a}
    pub fn pow(&self,p:u64)->Self{
        let mut exp=p;
        let mut now=*self;
        let mut ans=ModInt::new(1);
        while exp>0{
            if (exp&1)==1{ans*=now;}
            now*=now;
            exp>>=1;
        }
        ans
    }
    // pub fn comb(k:i32)->Self{
    //     Self::new(k)
    // }
    pub fn inv(&self)->Self{Self::new(inv_mod(self.a as u64,M::m64())as u32)}
}

impl<M:Mod>Clone for ModInt<M>{
    fn clone(&self)->Self{ModInt::new(self.a)}
}
impl<M:Mod>Copy for ModInt<M>{}
impl<M:Mod>From<i64>for ModInt<M>{
    fn from(i:i64)->Self{Self::newi64(i)}
}
impl<M:Mod>From<i32>for ModInt<M>{
    fn from(i:i32)->Self{Self::newi64(i as i64)}
}

impl<M:Mod>FromStr for ModInt<M>{
    type Err = ParseIntError;
    fn from_str(i:&str)->Result<Self, Self::Err>{
        let res=i.parse::<i64>()?;
        Ok(Self::newi64(res))
    }
}
impl<M:Mod>Sum for ModInt<M>{
    fn sum<I>(iter: I) -> Self where I: Iterator<Item = Self>,{
        iter.fold(Self::new(0), |b, i| b + i)
    }
}

impl<M:Mod>Product for ModInt<M>{
    fn product<I>(iter: I) -> Self where I: Iterator<Item = Self>,{
        iter.fold(Self::new(0), |b, i| b * i)
    }
}
impl<M:Mod>Add for ModInt<M>{
    type Output=Self;
    fn add(self,rhs:Self)->Self{
        let a=self.a+rhs.a;
        ModInt::new(if a>=M::m(){a-M::m()}else{a})
    }
}
impl<M:Mod>Sub for ModInt<M>{
    type Output=Self;
    fn sub(self,rhs:Self)->Self{
        ModInt::new(if self.a<rhs.a{M::m()+self.a-rhs.a}else{self.a-rhs.a})
    }
}
impl<M:Mod>Mul for ModInt<M>{
    type Output=Self;
    fn mul(self,rhs:Self)->Self{
        ModInt::newu64(self.a as u64*rhs.a as u64)
    }
}
impl<M:Mod>Div for ModInt<M>{
    type Output=Self;
    fn div(self,rhs:Self)->Self{
        self*rhs.inv()
    }
}
impl<M:Mod>Neg for ModInt<M> {
    type Output = Self;
    fn neg(self) -> Self {
        ModInt::new(M::m()-self.value())
    }
}
impl<M:Mod>AddAssign for ModInt<M>{fn add_assign(&mut self,rhs:Self){*self=*self+rhs;}}
impl<M:Mod>SubAssign for ModInt<M>{fn sub_assign(&mut self,rhs:Self){*self=*self-rhs;}}
impl<M:Mod>MulAssign for ModInt<M>{fn mul_assign(&mut self,rhs:Self){*self=*self*rhs;}}
impl<M:Mod>DivAssign for ModInt<M>{fn div_assign(&mut self,rhs:Self){*self=*self/rhs;}}

impl<M:Mod>std::fmt::Debug for ModInt<M>{
    fn fmt(&self,f:&mut std::fmt::Formatter)->Result<(),std::fmt::Error>{
        write!(f,"M{}",self.a)
    }
}
impl<M:Mod> std::fmt::Display for ModInt<M> {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
        self.value().fmt(f)
    }
}

}  // mod mod_int

}  // mod math

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: 44428