n,q = map(int,input().split())
a,b = [],[]
for i in range(n-1):
    a1,b1=[int(i) for i in input().split()]
    a.append(a1)
    b.append(b1)
p,x = [],[]
for j in range(q):
    p1,x1=[int(j) for j in input().split()]
    p.append(p1)
    x.append(x1)
    
z = [0]*n
for k in range(q):
  z[p[k]-1] = z[p[k]-1] + x[k]
for l in range(n-1):
  z[b[l]-1] = z[b[l]-1] + z[a[l]-1]    
print(*z)