// よそ様のコピペを試してるだけです
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let q: usize = read();
    let mut ab: Vec<(usize, usize)> = (0..n - 1).map(|_| (read(), read())).collect();
    let px: Vec<(usize, i32)> = (0..q).map(|_| (read(), read())).collect();

    ab.sort();
    let mut sum = vec![0; n];
    for &(p, x) in px.iter() {
        sum[p - 1] += x;
    }

    for &(a, b) in ab.iter() {
        sum[b - 1] += sum[a - 1];
    }

    for i in 0..sum.len() - 1 {
        print!("{} ", sum[i]);
    }
    println!("{}", sum[sum.len() - 1]);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}
