// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! p {
    ($($x:expr),*) => {
        $(println!("{:?}", $x);)*
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        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_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)*}
    };

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

macro_rules! read_value {
    ($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, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
#[allow(unused_imports)]
use std::cmp::*;
trait Each: Iterator {
    fn each<F>(self, mut f: F)
    where
        Self: Sized,
        F: FnMut(Self::Item),
    {
        self.fold((), move |(), item| f(item));
    }
}
impl<T: Iterator> Each for T {}

#[derive(Clone, Debug)]
struct SimpleNode<T> {
    value: T,
    child: Vec<usize>,
    connect_root: bool,
}

fn main() {
    input! {
        n:usize1,
        q:usize,
        mut ab: [(usize, usize); n],
        px: [(usize,i32);q],
    }

    let mut tree = vec![
        SimpleNode {
            value: 0,
            child: vec![],
            connect_root: false
        };
        n + 1
    ];
    tree[0].connect_root = true;
    ab.sort_by_key(|x| x.0);
    let mut ab_ = vec![];
    while !&ab.is_empty(){
        for (a, b) in &ab {
            if tree[a - 1].connect_root {
                tree[b - 1].connect_root = true;
                tree[a - 1].child.push(b - 1);
            } else if tree[b - 1].connect_root {
                tree[a - 1].connect_root = true;
                tree[b - 1].child.push(a - 1);
            } else {
                ab_.push((*a,*b));
            }
        }
        ab = ab_;
    }
    
    px.iter().each(|&(p, x)| tree[p - 1].value += x);
    f(&mut tree, 0, 0);
    tree.iter().each(|x|print!("{} ", x.value));
}

fn f(tree: &mut [SimpleNode<i32>], i:usize, v: i32){
    tree[i].value += v;
    let k = tree[i].child.clone();
    let l = tree[i].value.clone();
    k.iter().each(|x|f(tree, *x, l))
}
