program main
    implicit none
    integer n,q,a,b,c,p,x,i,st_size,s,t
    integer,allocatable::d(:),v(:,:),ans(:),st(:)
    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.
    allocate(st(n))
    st(1)=1
    st_size=1
    do while(st_size>0)
        s=st(st_size)
        st_size=st_size-1
        f(s)=.false.
        do i=1,d(s)
            t=g(s)%array(i)
            if(f(t))then
                ans(t)=ans(t)+ans(s)
                st_size=st_size+1
                st(st_size)=t
            end if
        end do
    end do
    print '(i0)',ans
end program main