using System;
using System.Collections.Generic;
using System.Linq;


public class Contest
{
	public static void Main()
	{

/*
		int n = a[0];
		int[][] e;
		MyIO.ReadMatrix(n, out e);

		int[] a;
		MyIO.ReadArray(out a);

        long a,b,c,d,e,f;
        MyIO.ReadMulti(out a, out b, out c, out d, out e, out f);

		MyIO.WriteArray(ans);
*/

        int n,q;
		Tuple<int,int>[] a, p;
		MyIO.ReadMulti(out n, out q);
		MyIO.ReadLines(n-1, out a);
		MyIO.ReadLines(q, out p);


		List<int>[] child = new List<int>[n+1];
		child[0] = new List<int>();
		child[0].Add(1);
		child[1] = new List<int>();
		child[1].Add(0);
		for(int i=0; i<n-1; i++){
			if(child[a[i].Item1]==null)child[a[i].Item1]=new List<int>();
			if(child[a[i].Item2]==null)child[a[i].Item2]=new List<int>();
			child[a[i].Item1].Add(a[i].Item2);
			child[a[i].Item2].Add(a[i].Item1);
		}

		int[] add = new int[n+1];
		for(int i=0; i<q; i++){
			add[p[i].Item1] += p[i].Item2; 
		}

		int[] sum = new int[n+1];
		sum[1] = add[1];
		rec(0, 1, add, sum, child);

		MyIO.WriteArray(sum.Skip(1).ToArray());
		
	}

	private static void rec(int parent, int id, int[] add, int[] sum, List<int>[] child){
		foreach(int e in child[id]){
			if(e==parent) continue;
			sum[e] = sum[id]+add[e];
			rec(id, e, add, sum, child);
		}
	}


}

public static class MyIO
{
	private static bool eq<T, U>() => typeof(T).Equals(typeof(U));
	private static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
	private static T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
	                                  : eq<T, long>()   ? ct<T, long>(long.Parse(s))
	                                  : eq<T, double>() ? ct<T, double>(double.Parse(s))
	                                  : eq<T, char>()   ? ct<T, char>(s[0])
	                                                    : ct<T, string>(s);
	public static string[] ReadArray<T>(out T[] a) {		
		var ar = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); 												
		a = System.Array.ConvertAll(ar, new Converter<string,T>(cv<T>));
		return ar;
	}										
	public static string[] ReadMulti<T>(out T a) {
		var ar = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); 
		a = cv<T>(ar[0]);
		return ar;
	}
	public static string[] ReadMulti<T, U>(out T a, out U b) {
		var ar = ReadMulti<T>(out a); 
        b = cv<U>(ar[1]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V>(out T a, out U b, out V c) {
		var ar = ReadMulti<T, U>(out a, out b); 
        c = cv<V>(ar[2]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W>(out T a, out U b, out V c, out W d) {
		var ar = ReadMulti<T, U, V>(out a, out b, out c); 
        d = cv<W>(ar[3]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e) {
		var ar = ReadMulti<T, U, V, W>(out a, out b, out c, out d); 
        e = cv<X>(ar[4]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f) {
		var ar = ReadMulti<T, U, V, W, X>(out a, out b, out c, out d, out e); 
        f = cv<Y>(ar[5]);
		return ar;
	}
	public static string[][] ReadMatrix<T>(int n, out T[][] a) {
		a = new T[n][];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) arr[i] = ReadArray(out a[i]);
		return arr;
	}
	public static string[][] ReadLines<T>(int n, out T[] a) {
		a = new T[n];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) arr[i] = ReadMulti(out a[i]);
		return arr;
	}
	public static string[][] ReadLines<T, U>(int n, out Tuple<T, U>[] a) {
		a = new Tuple<T, U>[n];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) {
			T q; U r;
			arr[i] = ReadMulti(out q, out r);
			a[i] = new Tuple<T, U>(q, r);
		}
		return arr;
	}
	public static string[][] ReadLines<T, U, V>(int n, out Tuple<T, U, V>[] a) {
		a = new Tuple<T, U, V>[n];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) {
			T q; U r; V s;
			arr[i] = ReadMulti(out q, out r, out s);
			a[i] = new Tuple<T, U, V>(q, r, s);
		}
		return arr;
	}

	public static void WriteArray<T>(T[] a) {
		Console.WriteLine(string.Join(" ", Array.ConvertAll(a, x => x.ToString())));
	}


}



Measured memory_bytes: 104252