let input = readLine()!.characters.split(" ").map{Int(String($0))!}
var tree = (0...input[0]).map{_ in 0}
for _ in 1..<input[0] {
    let input = readLine()!.characters.split(" ").map{Int(String($0))!}
    tree[input[1]] = input[0]
}
var cnt = (0...input[0]).map{_ in 0}
for _ in 0..<input[1] {
    let input = readLine()!.characters.split(" ").map{Int(String($0))!}
    cnt[input[0]] += input[1]
}
for i in 1...input[0] {
    cnt[i] += cnt[tree[i]]
    print(cnt[i])
}