fn main() {
    let mut _r = acio::Reader::from_stdin();
    let n: usize = _r.read();
    let q: usize = _r.read();
    let mut es = vec![vec![]; n];
    for _ in 0..(n - 1) {
        let a: usize = _r.read();
        let b: usize = _r.read();
        es[a - 1].push(b - 1);
    }
    let mut ps = vec![0; n];
    for _ in 0..q {
        let p: usize = _r.read();
        let x: usize = _r.read();
        ps[p - 1] += x;
    }
    for (a, v) in es.iter().enumerate() {
        for b in v {
            ps[*b] += ps[a];
        }
    }
    let res = ps
        .iter()
        .map(|i| format!("{}", i))
        .collect::<Vec<String>>()
        .join(" ");
    println!("{}", res);
}

//-- MODULES --

/// Mathematics Module
#[allow(dead_code)]
mod math {
    /// Methods for Each Integer Type
    trait Integer {
        fn lcm(v1: Self, v2: Self) -> Self;
        fn gcd(v1: Self, v2: Self) -> Self;
    }

    /// Implements trait Integer
    macro_rules! integer {
        ($t:ty) => {
            impl Integer for $t {
                fn lcm(v1: $t, v2: $t) -> $t {
                    v1 * v2 / Self::gcd(v1, v2)
                }

                fn gcd(v1: $t, v2: $t) -> $t {
                    let (mut v1, mut v2) = (v1, v2);
                    while v1 != v2 {
                        if v1 < v2 {
                            v2 -= v1;
                        } else {
                            v1 -= v2;
                        }
                    }
                    v1
                }
            }
        };
    }

    // BEGIN DECLARATIONS
    integer!(i8);
    integer!(i16);
    integer!(i32);
    integer!(i64);
    integer!(isize);
    integer!(u8);
    integer!(u16);
    integer!(u32);
    integer!(u64);
    integer!(usize);
    // END DECLARATIONS
}

/// IO Module for AtCoder
#[allow(dead_code)]
mod acio {
    use std::fmt::Debug;
    use std::io::{stdin, BufRead, BufReader, Read, Stdin};
    use std::str::FromStr;

    /// Multi-Purpose Value Reader
    pub struct Reader<R>
    where
        R: Read,
    {
        input: BufReader<R>,
        stack: Vec<String>,
    }

    impl<R: Read> Reader<R> {
        /// Create Reader from Read
        pub fn new<T>(input: R) -> Self {
            Reader {
                input: BufReader::new(input),
                stack: vec![],
            }
        }

        /// Read Multiple Value
        pub fn read_by<F>(&mut self, count: usize) -> Vec<F>
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            (0..count).map(|_| self.read()).collect()
        }

        /// Read Single Value
        pub fn read<F>(&mut self) -> F
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            while self.stack.is_empty() {
                let mut line = self.read_line();
                self.stack.append(&mut line);
                self.stack.reverse();
            }
            self.stack.pop().unwrap().parse().unwrap()
        }

        /// Read Space Split Line
        fn read_line(&mut self) -> Vec<String> {
            let mut buf = String::new();
            self.input.read_line(&mut buf).unwrap();
            buf.split_whitespace().map(|s| s.to_string()).collect()
        }
    }

    impl Reader<Stdin> {
        /// Create Reader from stdin
        pub fn from_stdin() -> Self {
            Self::new::<Reader<Stdin>>(stdin())
        }
    }

    /*
    // FOR DEBUG
    impl<T> Drop for Reader<T> {
        fn drop(&mut self) {
            if self.stack.len() != 0 {
                panic!("Reader with remaining value was dropped.")
            }
        }
    }
    */
}


Measured memory_bytes: 30972