using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;


class Program
{

    static void Main()
    {
        int[] NQ = ReadIntN();
        int N = NQ[0];
        int Q = NQ[1];

        //木の番号は1から
        List<int>[] tree = new List<int>[N + 1];
        int[] counters = new int[N];
        int[] addPoints = new int[N + 1];

        for (int i = 1; i <= N; i++) tree[i] = new List<int>();

        for (int i = 1; i < N; i++)
        {
            int[] ab = ReadIntN();
            tree[ab[0]].Add(ab[1]);
            tree[ab[1]].Add(ab[0]);
        }

        for (int i = 0; i < Q; i++)
        {
            int[] node_point = ReadIntN();
            addPoints[node_point[0]] += node_point[1];
        }

        int currentPoint = 1;
        Queue<int[]> queue = new Queue<int[]>();
        bool[] doneNode = new bool[N + 1];
        queue.Enqueue(new int[2] { currentPoint, 0 });
        while (queue.Count > 0)
        {
            int[] index_addPoint = queue.Dequeue();
            int index = index_addPoint[0];
            int addPoint = index_addPoint[1];

            counters[index - 1] += (addPoint + addPoints[index]);
            doneNode[index] = true;
            foreach (var next in tree[index])
            {
                if (!doneNode[next]) queue.Enqueue(new int[2] { next, addPoint + addPoints[index] });
            }
        }

        WriteLine(string.Join(" ", counters));
        ReadLine();
    }

    #region Reader
    static string ReadStr()
    {
        return Console.ReadLine();
    }
    static string[] ReadStrN()
    {
        return Console.ReadLine().Split(' ');
    }
    static int ReadInt()
    {
        return Convert.ToInt32(Console.ReadLine());
    }
    static int[] ReadIntN()
    {
        return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray();
    }
    static long ReadLong()
    {
        return Convert.ToInt64(Console.ReadLine());
    }
    static long[] ReadLongN()
    {
        return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray();
    }
    static long[,] ReadLongMatrix(int r, int c)
    {
        var mat = new long[r, c];
        for (int i = 0; i < r; ++i)
        {
            var x = ReadLongN();
            for (int j = 0; j < c; ++j)
            {
                mat[i, j] = x[j];
            }
        }
        return mat;
    }
    static Tuple<string, string>[] ReadTupleStr(int n)
    {
        List<Tuple<string, string>> list = new List<Tuple<string, string>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadStrN();
            list.Add(new Tuple<string, string>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Tuple<long, long>[] ReadTupleLong(int n)
    {
        List<Tuple<long, long>> list = new List<Tuple<long, long>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadLongN();
            list.Add(new Tuple<long, long>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Tuple<int, int>[] ReadTupleInt(int n)
    {
        List<Tuple<int, int>> list = new List<Tuple<int, int>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadIntN();
            list.Add(new Tuple<int, int>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Tuple<double, double>[] ReadTupleDouble(int n)
    {
        List<Tuple<double, double>> list = new List<Tuple<double, double>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadLongN();
            list.Add(new Tuple<double, double>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Dictionary<int, HashSet<int>> ReadAdjacencyList(int N, int M)
    {
        Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
        for (int i = 0; i <= N; ++i)
        {
            dict.Add(i, new HashSet<int>());
        }
        for (int i = 0; i < M; ++i)
        {
            var ab = ReadIntN();
            dict[ab[0]].Add(ab[1]);
            dict[ab[1]].Add(ab[0]);
        }
        return dict;
    }
    #endregion
}



Measured memory_bytes: 56772