using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApp4
{
	class Program
	{
		static void Main(string[] args)
		{
			var nq = Console.ReadLine().Split(' ');
			int n = int.Parse(nq[0]);
			int q = int.Parse(nq[1]);
			var elements = new List<Element>(n);
			for (int i = 1; i <= n; i++)
			{
				elements.Add(new Element());
			}

			for (int i = 1; i < n; i++)
			{
				var ab = Console.ReadLine().Split(' ');
				int a = int.Parse(ab[0]);
				int b = int.Parse(ab[1]);

				elements[a - 1].AddChild(elements[b - 1]);
			}

			var addDict = new Dictionary<int, int>();
			for (int i = 0; i < q; i++)
			{
				var px = Console.ReadLine().Split(' ');
				int p = int.Parse(px[0]);
				int x = int.Parse(px[1]);

				if (addDict.ContainsKey(p))
				{
					addDict[p] += x;
				}
				else
				{
					addDict.Add(p, x);
				}
			}

			foreach(var e in addDict)
			{
				elements[e.Key - 1].UpCount(e.Value);
			}

			var sb = new StringBuilder();
			for (int i = 0; i < n; i++)
			{
				sb.Append(elements[i].mCount + " ");
			}
			Console.WriteLine(sb);
		}

		public class Element
		{
			public int mCount;
			List<Element> mChildren;

			public Element()
			{
				mCount = 0;
			}

			public void AddChild(Element child)
			{
				if (mChildren == null)
				{
					mChildren = new List<Element>();
				}
				mChildren.Add(child);
			}

			public void UpCount(int count)
			{
				mCount += count;

				if (mChildren == null)
				{
					return;
				}
				foreach(var ch in mChildren)
				{
					ch.UpCount(count);
				}
			}
		}
	}
}
