package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

type edge struct {
	a int64
	b int64
}

type operation struct {
	p int64
	q int64
}

type node struct {
	nexts []int64
}

func remove(s []int64, i int) []int64 {
	s[i] = s[len(s)-1]
	return s[:len(s)-1]
}

func solve(n int64, q int64, es []edge, os []operation) []int64 {
	ret := make([]int64, n)

	ns := make([]node, n)
	for _, e := range es {
		if len(ns[e.a].nexts) == 0 {
			ns[e.a].nexts = []int64{e.b}
		} else {
			ns[e.a].nexts = append(ns[e.a].nexts, e.b)
		}
		if len(ns[e.b].nexts) == 0 {
			ns[e.b].nexts = []int64{e.a}
		} else {
			ns[e.b].nexts = append(ns[e.b].nexts, e.a)
		}
	}

	for _, o := range os {
		ret[o.p] += o.q
	}
	queue := []int64{0}
	for ; len(queue) > 0; {
		q := queue[0]
		queue = queue[1:]
		node := ns[q]
		if len(node.nexts) == 0 {
			continue
		}
		for _, nn := range node.nexts {
			ret[nn] += ret[q]
			for i, nnn := range ns[nn].nexts {
				if nnn == q {
					ns[nn].nexts = remove(ns[nn].nexts, i)
					break
				}
			}
		}
		queue = append(queue, node.nexts...)
	}

	return ret
}

func main() {
	defer out.Flush()

	n := nextInt()
	q := nextInt()

	es := make([]edge, n-1)
	for i, _ := range es {
		es[i].a = nextInt() - 1
		es[i].b = nextInt() - 1
	}
	os := make([]operation, q)
	for i, _ := range os {
		os[i].p = nextInt() - 1
		os[i].q = nextInt()
	}
	res := solve(n, q, es, os)
	for i, r := range res {
		fmt.Fprint(out, r)
		if int64(i) < n - 1 {
			fmt.Fprint(out, " ")
		} else {
			fmt.Fprintln(out)
		}
	}
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 30576