import qualified Data.ByteString.Char8 as C
import Data.List
import Control.Monad

import qualified Data.IntMap as M
import qualified Data.Sequence as S

import Data.Foldable(toList)
import Data.Maybe(fromMaybe)


r :: IO [Int]
r  = unfoldr (C.readInt . C.dropWhile (==' ')) <$> C.getLine

rp :: IO (Int,Int)
rp  = toTup . unfoldr (C.readInt . C.dropWhile (==' ')) <$> C.getLine
    where toTup [a,b] = (a,b)


main :: IO ()
main = do
    [n,q] <- r :: IO [Int]

    ab <- replicateM (n-1) $ do
        [a,b] <- r
        return (a, S.singleton b)
    let treeMp = M.fromListWith (S.><) ab :: M.IntMap (S.Seq Int)

    px <- replicateM q rp
    let modifMp = M.fromListWith (+) px :: M.IntMap Int

    let res = solve 1 0 treeMp modifMp
    putStrLn $ intercalate " " $ map (show . snd) (sortOn fst $ toList res)


solve :: Int -> Int -> M.IntMap (S.Seq Int) -> M.IntMap Int -> S.Seq (Int,Int)
solve pos vac treeMp modifMp =
    let children    = fromMaybe S.empty (M.lookup pos treeMp)
        curVal      = fromMaybe 0 (M.lookup pos modifMp)
        newVal      = curVal + vac
        resElm      = (pos, newVal)
    in  resElm S.<| (do nPos <- children
                        solve nPos newVal treeMp modifMp)