using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        SetOut(new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        var N = FastIO.Int();
        var Q = FastIO.Int();
        var g = new List<int>[N];
        for (int i = 0; i < g.Length; i++) g[i] = new List<int>();
        for (int i = 0; i < N - 1; i++)
        {
            var a = FastIO.Int() - 1;
            var b = FastIO.Int() - 1;
            g[a].Add(b);
            g[b].Add(a);
        }

        var l = new int[0];
        var r = new int[0];
        EulerTour(g, 0, out l, out r);
        var st = new CommutativeDual<int>(N, (x, y) => x + y, 0);
        for (int i = 0; i < Q; i++)
        {
            var p = FastIO.Int() - 1;
            var x = FastIO.Int();
            st.Update(l[p], r[p], x);
        }

        for (int i = 0; i < N; i++) WriteLine(st.Query(l[i]));
        Out.Flush();
    }

    public static void EulerTour(List<int>[] graph, int root, out int[] l, out int[] r)
    {
        var n = graph.Length;
        l = new int[n];
        r = new int[n];
        var k = 0;
        DFS(root, -1, ref k, graph, l, r);
    }

    public static void DFS(int v, int p, ref int k, List<int>[] g, int[] l, int[] r)
    {
        l[v] = k++;
        foreach (var u in g[v])
        {
            if (u == p) continue;
            DFS(u, v, ref k, g, l, r);
        }
        r[v] = k;
    }
}

public class CommutativeDual<E>
{
    E[] lazy;
    Func<E, E, E> H;
    E EI;
    int N;
    public int Length => N;

    public CommutativeDual(int length, Func<E, E, E> h, E ei)
    {
        N = length;
        lazy = new E[N * 2];
        for (int i = 1; i < lazy.Length; i++)
        {
            lazy[i] = ei;
        }

        EI = ei;
        H = h;
    }

    public void Update(int l, int r, E v)
    {
        l += N;
        r += N;
        while (l < r)
        {
            if ((l & 1) == 1)
            {
                lazy[l] = H(lazy[l], v);
                l++;
            }
            if ((r & 1) == 1)
            {
                --r;
                lazy[r] = H(lazy[r], v);
            }
            l >>= 1;
            r >>= 1;
        }
    }

    public E Query(int k)
    {
        k += N;
        var ret = lazy[k];
        while (k > 1)
        {
            ret = H(ret, lazy[k >> 1]);
            k >>= 1;
        }
        return ret;
    }
}

public static class FastIO
{
    static System.IO.Stream str = System.Console.OpenStandardInput();
    const int size = 1024;
    static byte[] buffer = new byte[size];
    static int ptr;
    static int len;

    static byte Read()
    {
        if (ptr == len)
        {
            len = str.Read(buffer, 0, size);
            if (len == 0) return 0;
            ptr = 0;
        }
        return buffer[ptr++];
    }

    public static int Int()
    {
        var c = Read();
        while (c < 0x21)
        {
            c = Read();
        }
        var n = false;
        if (c == '-')
        {
            n = true;
            c = Read();
        }
        var ret = 0;
        while (c > 0x20)
        {
            ret = ret * 10 + c - '0';
            c = Read();
        }
        return n ? -ret : ret;
    }

    public static long Long()
    {
        var c = Read();
        while (c < 0x21)
        {
            c = Read();
        }
        var n = false;
        if (c == '-')
        {
            n = true;
            c = Read();
        }
        var ret = 0L;
        while (c > 0x20)
        {
            ret = ret * 10 + c - '0';
            c = Read();
        }
        return n ? -ret : ret;
    }
}


Measured memory_bytes: 66420