package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

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

func init() {
	// read one word/char/int separated by space(s).
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 5000000), 5000000)

	// read one line.
	// sc.Split(bufio.ScanLines)
}

type node struct {
	val    int
	parent int
}

type nodes []node

func main() {
	// var n, q int
	// fmt.Scanf("%d %d", &n, &q)
	n := nextInt()
	q := nextInt()
	ns := make(nodes, n+1)
	for i := 0; i < n-1; i++ {
		// var parent, child int
		parent := nextInt()
		child := nextInt()
		fmt.Scanf("%d %d", &parent, &child)
		ns[child].parent = parent
	}

	for i := 0; i < q; i++ {
		// var a, b int
		// fmt.Scanf("%d %d", &a, &b)
		a := nextInt()
		b := nextInt()
		ns[a].val += b
	}
	for i := 1; i < len(ns); i++ {
		ns[i].val += ns[ns[i].parent].val
		fmt.Printf("%d", ns[i].val)
		if i == len(ns)-1 {
			fmt.Print("\n")
			continue
		}
		fmt.Print(" ")
	}
}
