package main

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

// -----------------------------------------------------------------------------
// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the key call.
var nextToken func() ([]byte, error)

// OutputBuffer Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// OutputWriter Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// SetInteractive SetInteractive Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// SetOutput Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flush Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// IsSpace Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

// SetInput Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial
}

// SetUnbefferedInput Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------
// Simple math functions

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// =============================================================================
func init() {
	// for non-interactive
	// SetInput(os.Stdin)
	// SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	SetInteractive(os.Stdout, os.Stdin)
}

var sum []int64
var g *Graph

func calc(now, pre int) {
	l, ok := g.Get(now)
	if !ok {
		return
	}
	for i := range l {
		if l[i] == pre {
			continue
		}
		sum[l[i]] += sum[now]
		calc(l[i], now)
	}
}

func main() {
	defer Flush()

	N := readi()
	Q := readi()
	var a, b int
	g = NewGraph()
	for i := 0; i < N-1; i++ {
		a = readi() - 1
		b = readi() - 1
		g.Add(a, b)
		g.Add(b, a)
	}
	sum = make([]int64, N)
	var p, x int
	for i := 0; i < Q; i++ {
		p = readi() - 1
		x = readi()
		sum[p] += int64(x)
	}
	// g.Dump()
	calc(0, -1)
	for i := 0; i < N; i++ {
		printf("%d ", sum[i])
	}
	println("")
}

// =======================================================

// Graph 重みなしグラフのデータ
type Graph struct {
	edge   map[int][]int // 辺（頂点Ａから繋がる頂点のリスト）
	vertex map[int]int   // 全ての頂点（セットの替わり）
}

// NewGraph グラフの初期化
func NewGraph() *Graph {
	return &Graph{map[int][]int{}, map[int]int{}}
}

// Add グラフへの頂点の追加 key --> pp(頂点番号と距離)
func (g *Graph) Add(from, to int) {
	ll, ok := g.edge[from]
	if !ok {
		ll = []int{}
	}
	ll = append(ll, to)
	g.edge[from] = ll
	// for i := 0; i < len(ll); i++ {
	// 	printf("from = %d  --> %d\n", from, ll[i])
	// }
	g.vertex[from] = 0
	g.vertex[to] = 0
}

// Get 指定された頂点に紐づく 頂点番号のリストを返す
func (g *Graph) Get(key int) ([]int, bool) {
	ll, ok := g.edge[key]
	if ok {
		return ll, true
	}
	return nil, false
}

// Contains 指定された頂点がグラフの開始点に登録されているか
func (g *Graph) Contains(key int) bool {
	_, ok := g.edge[key]
	return ok
}

// Contains2 指定された頂点がグラフに登録されているか（終点のみを含む）
func (g *Graph) Contains2(key int) bool {
	_, ok := g.vertex[key]
	return ok
}

// Connect 指定された２つの頂点がつながっていれば　true
func (g *Graph) Connect(from, to int) bool {
	ll, ok := g.edge[from]
	if ok {
		for i := range ll {
			if ll[i] == to {
				return true
			}
		}
	}
	return false
}

// Dump ダンプ
func (g *Graph) Dump() {
	for k, v := range g.edge {
		for i := range v {
			printf("from[%d} --> to[%d]\n", k, v[i])
		}
	}
}

// =======================================================

// =============================================================================


Measured memory_bytes: 76616