program abc138d
    implicit none
    integer::N,Q,A,B,P,X
    integer::i
    integer,allocatable,dimension(:)::U,T
    read*,N,Q
    allocate(U(0:N),T(0:N))
    U=0;T=0
    do i=1,N-1
        read*,A,B
        U(B)=A
    end do
    do i=1,Q
        read*,P,X
        T(P)=T(P)+X
    end do
    do i=1,N
        T(i)=T(i)+T(U(i))
        print"(i0)",T(i)
    end do
end program