// Codeforces 1.12.6
// AtCoder 1.6
// Paiza 1.7.3

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type in struct {
	Scanner *bufio.Scanner
}

func (in *in) s() string {
	in.Scanner.Scan()
	return in.Scanner.Text()
}
func (in *in) i() int64 {
	return in.ibase(10)
}
func (in *in) ibase(base int) int64 {
	i, _ := strconv.ParseInt(in.s(), base, 64)
	return i
}
func (in *in) f() float64 {
	i, _ := strconv.ParseFloat(in.s(), 64)
	return i
}
func (in *in) ss(n int64) []string {
	a := make([]string, n)
	for i := range a {
		a[i] = in.s()
	}
	return a
}
func (in *in) is(n int64) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = in.i()
	}
	return a
}
func (in *in) fs(n int64) []float64 {
	a := make([]float64, n)
	for i := range a {
		a[i] = in.f()
	}
	return a
}
func (in *in) imat(h int64, w int64) [][]int64 {
	a := make([][]int64, h)
	for y := range a {
		a[y] = make([]int64, w)
		for x := range a[y] {
			a[y][x] = in.i()
		}
	}
	return a
}

func stdin() in {
	scn := bufio.NewScanner(os.Stdin)
	scn.Split(bufio.ScanWords)
	max := 200000
	buf := make([]byte, max)
	scn.Buffer(buf, max)
	return in{Scanner: scn}
}

type lm struct{}

func (*lm) max(a int64, b int64) int64 {
	if a > b {
		return a
	}
	return b
}
func (*lm) min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func (*lm) abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}
func (lm *lm) gcd(a, b int64) int64 {
	// returns greatest common divisor.
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return lm.gcd(b, a%b)
}
func (lm *lm) lcm(a, b int64) int64 {
	// returns least common multiple.
	gcd := lm.gcd(a, b)
	return gcd * (a / gcd) * (b / gcd)
}

type su struct{}

func (*su) iarr(arr []int64) string {
	// int slice to string.
	ret := make([]string, len(arr))
	for i, x := range arr {
		ret[i] = strconv.FormatInt(x, 10)
	}
	return strings.Join(ret, " ")
}
func (*su) ilns(arr []int64) string {
	// int slice to string.
	ret := make([]string, len(arr))
	for i, x := range arr {
		ret[i] = strconv.FormatInt(x, 10)
	}
	return strings.Join(ret, "\n")
}
func (su *su) imat(matrix [][]int64) string {
	// int slice matrix to string.
	ret := make([]string, len(matrix))
	for i := range matrix {
		ret[i] = su.iarr(matrix[i])
	}
	return strings.Join(ret, "\n")
}
func (*su) bool(b bool) str {
	if b {
		return "Yes"
	}
	return "No"
}

type str string

func (s str) upper() string { return strings.ToUpper(string(s)) }
func (s str) lower() string { return strings.ToLower(string(s)) }

type i64s []int64

func (p i64s) Len() int           { return len(p) }
func (p i64s) Less(i, j int) bool { return p[i] < p[j] }
func (p i64s) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }

func push(p []int64, x int64) []int64           { return append(p, x) }
func pop(p []int64, x int64) ([]int64, int64)   { return p[:len(p)-1], p[len(p)-1] }
func unshift(p []int64, x int64) []int64        { return append([]int64{x}, p...) }
func shift(p []int64, x int64) ([]int64, int64) { return p[1:], p[0] }

func main() {
	// utilities.
	const zz int64 = int64(0)
	const mod int64 = int64(1000000007)
	in, lm, su := stdin(), lm{}, su{}
	_, _, _ = in, lm, su

	// read here.
	n, q := in.i(), in.i()

	// ch[i] = nodes connected to node i.
	ch := make([][]int64, n)
	for i := zz; i < n-1; i++ {
		a, b := in.i()-1, in.i()-1
		ch[a] = append(ch[a], b)
		ch[b] = append(ch[b], a)
	}

	// ope[i] = counts added to the node i
	ope := make([]int64, n)
	for i := zz; i < q; i++ {
		p, x := in.i()-1, in.i()
		ope[p] += x
	}

	// solve here.

	ans := make([]int64, n)

	// BFS
	vis := make([]bool, n)
	var qu [][]int64
	var vc []int64

	// root
	qu = append(qu, []int64{0, 0})
	for len(qu) != 0 {
		// pop
		qu, vc = qu[:len(qu)-1], qu[len(qu)-1]
		v, c := vc[0], vc[1]
		if vis[v] {
			continue
		}
		vis[v] = true
		ans[v] = c + ope[v]
		for _, w := range ch[v] {
			qu = append(qu, []int64{w, ans[v]})
		}
	}

	printable := su.iarr(ans)
	// print here.
	fmt.Println(printable)
}


Measured memory_bytes: 44032