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

namespace _200531
{
    using static Ex;
    public class Solve
    {
        public static void Main(string[] args)
        {
            new ABC138D();
        }
    }
    public class ABC138D
    {
        // N 個の頂点を持つ根付き木
        // 根は頂点 1
        // i 番目の辺 ( 1 ≤ i ≤ N − 1 ) は頂点 a i と頂点 b i
        long n, q;
        long[] arr;
        HashSet<long>[] node;
        public ABC138D()
        {
            var l = ReadLongArray();
            n = l[0];
            q = l[1];
            arr = new long[n];
            node = new HashSet<long>[n];
            for (long i = 0; i < n; i++)
            {
                node[i] = new HashSet<long>();
            }
            for (long i = 0; i < n - 1; i++)
            {
                var l1 = ReadLongArray();
                var a = l1[0]-1;
                var b = l1[1]-1;
                node[a].Add(b);
                node[b].Add(a);
            }
            // Q回の操作
            // 頂点pjを根とする部分木に含まれるすべての頂点のカウンターの値にxjを足す
            for (long i = 0; i < q; i++)
            {
                var l1 = ReadLongArray();
                var p = l1[0]-1;
                var x = l1[1];
                arr[p] += x;
            }
            dfs(0);
            string.Join(" ", arr).Cw();
        }

        void dfs(long i)
        {
            foreach (var v in node[i])
            {
                node[v].Remove(i);
                arr[v] += arr[i];
                dfs(v);
            }
        }
    }
    public class ABC168D
    {
        public ABC168D()
        {
        }
    }
    public class ABC167D
    {
        public ABC167D()
        {
        }
    }
    public class ABC166D
    {
        public ABC166D()
        {
        }
    }
    public class ABC165D
    {
        public ABC165D()
        {
        }
    }
    public class ABC164D
    {
        public ABC164D()
        {
        }
    }
    public class ABC163D
    {
        public ABC163D()
        {
        }
    }
    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }



        public static bool Mins<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
        public static bool Maxs<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
        public static void Swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
        public static void Swap<T>(List<T> list, int i, int j) { T tmp = list[j]; list[j] = list[i]; list[i] = tmp; }


        static long Gcd(long m, long n) { if (n == 0) return m; return Gcd(n, m % n); }
        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static void yesno(this bool b) { (b ? "yes" : "no").Cw(); }
        public static void YesNo(this bool b) { (b ? "Yes" : "No").Cw(); }
        public static void YESNO(this bool b) { (b ? "YES" : "NO").Cw(); }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public static int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        
    }
}


Measured memory_bytes: 101180