var input: (Int, Int) {
    let line = readLine()!.characters.split(" ").map{Int(String($0))!}
    return (line[0], line[1])
}
let (N, Q) = input
var tree = Array(count: N+1, repeatedValue: 0)
for _ in 1..<N {
    let (a, b) = input
    tree[b] = a
}
var cnt = Array(count: N+1, repeatedValue: 0)
for _ in 0..<Q {
    let (p, x) = input
    cnt[p] += x
}
for i in 1...N {
    cnt[i] += cnt[tree[i]]
    print(cnt[i])
}