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

namespace AtCoder
{
    public class MainClass
    {
        public static void Main(string[] args)
        {
            if (args.Length > 0 && args[0] == "debug")
            {
                var inputs = new[] { @"
4 3
1 2
2 3
2 4
2 10
1 100
3 1
				", @"
6 2
1 2
1 3
2 4
3 6
2 5
1 10
1 10
				", @"

				", @"

				" };

                foreach (var str in inputs)
                {
                    var text = str.Trim();
                    if (text.Length == 0) continue;
                    var reader = new System.IO.StringReader(text);
                    Console.SetIn(reader);
                    Main2(args);
                    Console.WriteLine();
                    Console.WriteLine("----------------------------------");
                    Console.WriteLine();
                }
            }
            else
                Main2(args);
        }

        public static void Main2(string[] args)
        {
            checked
            {
                var paramsList = Console.ReadLine().Split(' ').ToList();
                // NQ
                var N = int.Parse(paramsList[0]);
                var Q = int.Parse(paramsList[1]);

                var lines = EnumerablePlus.Repeat(N - 1, () =>
                {
                    var list = Console.ReadLine().Split(' ').ToList();
                    return new Line(int.Parse(list[0]), int.Parse(list[1]));
                }).ToList();

                var opers = EnumerablePlus.Repeat(Q, () =>
                {
                    var list = Console.ReadLine().Split(' ').ToList();
                    var p = new
                    { /*px*/
                        p = int.Parse(list[0]),
                        x = long.Parse(list[1]),
                    };
                    return p;
                }).ToList();

                var V = new long[N + 1];
                foreach (var ope in opers)
                {
                    V[ope.p] += ope.x;
                }

                var idx = new Dictionary<int, List<Line>>();
                foreach (var line in lines)
                {
                    List<Line> list;

                    if (!idx.TryGetValue(line.a, out list))
                    {
                        list = new List<Line>();
                        idx.Add(line.a, list);
                    }
                    list.Add(line);

                    if (!idx.TryGetValue(line.b, out list))
                    {
                        list = new List<Line>();
                        idx.Add(line.b, list);
                    }
                    list.Add(line);
                }

                TreeSearch(idx, V, 1);
                Console.WriteLine(V.Skip(1).MkString());
            }
        }

        private static void TreeSearch(Dictionary<int, List<Line>> idx, long[] V, int i)
        {
            var list = idx[i];
            foreach (var line in list)
            {
                if (line.visited) continue;
                line.visited = true;

                var another = (line.a == i ? line.b : line.a);
                V[another] += V[i];

                TreeSearch(idx, V, another);
            }
        }
    }

    public class Line
    {
        public readonly int a;
        public readonly int b;
        public bool visited = false;

        public Line(int a, int b)
        {
            this.a = a;
            this.b = b;
        }
    }

    public static class EnumerablePlus
    {
        ///<summary>出力文字列に変換。</summary>
        public static string MkString<T>(this IEnumerable<T> list)
        {
            return list.Aggregate(
                new System.Text.StringBuilder(),
                (a, b) => ((a.Length > 0) ? a.Append(' ') : a).Append(b)
                ).ToString();
        }

        ///<summary>添字付きfor。</summary>
        public static void ForEach<T>(this IEnumerable<T> list, Action<T, int> a)
        {
            int i = 0;
            foreach (var item in list)
            {
                a(item, i);
            }
        }

        ///<summary>指定回数デリゲートを呼び出す。</summary>
        public static IEnumerable<T> Repeat<T>(int n, Func<T> f)
        {
            for (int i = 0; i < n; i++)
            {
                yield return f();
            }
        }
    }

    public static class MathPlus
    {
        ///<summary>約数。順番は不定。</summary>
        public static List<long> Divisor(long n)
        {
            var list = Prime(n).
                GroupBy(id => id).
                Select(pair => new { prime = pair.Key, power = pair.Count() }).
                ToList();

            var result = list.Aggregate(new List<long>(), (left, pair) =>
            {
                var list2 = Enumerable.
                    Range(0, pair.power + 1).
                    Aggregate(new List<long>(), (res, l) =>
                    {
                        var next = res.Count > 0 ? res.Last() * pair.prime : 1L;
                        res.Add(next);
                        return res;
                    });

                if (left.Count == 0) return list2.ToList();

                return list2.
                    SelectMany(l => left.Select(m => l * m)).
                    ToList();
            });

            return result;
        }

        ///<summary>順列の数。</summary>
        public static long Permutation(long n, long r)
            => Factorial(n, r);

        ///<summary>組合せの数。</summary>
        public static long Combination(long n, long r)
        {
            if (r == 0) return 1;

            return Factorial(n, r) / Factorial(r);
        }

        ///<summary>階乗。カウントも指定可能。</summary>
        public static long Factorial(long a, long count = long.MaxValue)
        {
            long res = 1;

            for (long i = 0; a > 0 && i < count; i++)
            {
                checked { res *= a; }
                --a;
            }

            return res;
        }

        ///<summary>素因数分解。昇順。</summary>
        public static List<long> Prime(long a)
        {
            var res = new List<long>();

            for (long b = 2, c = (long)Math.Ceiling(Math.Sqrt(a)); b <= c; ++b)
            {
                while (a % b == 0)
                {
                    res.Add(b);
                    a = a / b;
                }
            }

            return res;
        }

        ///<summary>最小公倍数。</summary>
        public static long Lcm(IEnumerable<long> list)
        {
            return list.Aggregate((a, b) => Lcm(a, b));
        }

        ///<summary>最小公倍数。</summary>
        public static long Lcm(long a, long b)
        {
            return checked(a * b) / Gcd(a, b);
        }

        ///<summary>最大公約数。</summary>
        public static long Gcd(IEnumerable<long> list)
        {
            return list.Aggregate((a, b) => Gcd(a, b));
        }

        ///<summary>最大公約数。</summary>
        public static long Gcd(long a, long b)
        {
            if (a < b)
                Gcd(b, a);

            while (b != 0)
            {
                var rem = a % b;
                a = b;
                b = rem;
            }

            return a;
        }

        ///<summary>切り上げ。</summary>
        public static long Ceiling(long a, long b) => (a + (b - 1)) / b;
    }
}


Measured memory_bytes: 102112