import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n, q] <- getIntList
    edges <- VU.replicateM (n-1) $ do
        [a, b] <- getIntList
        return (a-1, b-1)
    pxs <- VU.replicateM q $ do
        [p, x] <- getIntList
        return (p-1, x)
    let nexts = V.create $ do
            vec <- VM.replicate n []
            VU.forM_ edges $ \(a, b) -> do
                VM.modify vec (b :) a
                VM.modify vec (a :) b
            return vec
        vals = VU.create $ do
            vec <- VUM.replicate n 0
            VU.forM pxs $ \(p, x) -> do
                VUM.modify vec (+ x) p
            return vec
        count = VU.create $ do
            vec <- VUM.replicate n 0
            let dfs par q acc = do
                    let acc' = acc + (vals VU.! q)
                    VUM.write vec q acc'
                    let clds = filter (/= par) (nexts V.! q)
                    forM_ clds $ \i -> dfs q i acc'
            dfs (-1) 0 0
            return vec
    putStrLn . unwords . map show $ VU.toList count