program main
    implicit none
    integer n,q,a,b,c,p,x,i
    integer,allocatable::d(:),v(:,:),ans(:)
    type parr
        integer,allocatable::array(:)
    end type
    type(parr),allocatable::g(:)
    logical,allocatable::f(:)
    read *,n,q
    allocate(d(n))
    allocate(v(n-1,2))
    d=0
    do i=1,n-1
        read *,a,b
        d(a)=d(a)+1
        d(b)=d(b)+1
        v(i,1)=a
        v(i,2)=b
    end do
    allocate(g(n))
    do i=1,n
        allocate(g(i)%array(d(i)))
    end do
    d=0
    do i=1,n-1
        a=v(i,1)
        b=v(i,2)
        d(a)=d(a)+1
        d(b)=d(b)+1
        g(a)%array(d(a))=b
        g(b)%array(d(b))=a
    end do
    deallocate(v)
    allocate(ans(n))
    ans=0
    do i=1,q
        read *,p,x
        ans(p)=ans(p)+x
    end do
    allocate(f(n))
    f=.true.
    call dfs(g,d,f,1,ans)
    print '(i0)',ans
contains
    recursive subroutine dfs(g,d,f,v,s)
        type(parr),intent(in)::g(:)
        integer,intent(in)::d(:),v
        integer,intent(inout)::s(:)
        logical,intent(inout)::f(:)
        integer i,u
        f(v)=.false.
        do i=1,d(v)
            u=g(v)%array(i)
            if(f(u))then
                s(u)=s(u)+s(v)
                call dfs(g,d,f,u,s)
            end if
        end do
    end subroutine dfs
end program main