import Control.Monad
import Data.Monoid
import Data.Maybe
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
import qualified Data.ByteString.Char8 as BS

main = do
  [n,q] <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
  edges <- VU.replicateM (n-1) $ do
    [a,b] <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
    return (a-1,b-1)
  operations <- VU.replicateM q $ do
    [p,x] <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
    return (p-1,x)
  let graph :: V.Vector [Int]
      graph = 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
      values :: VU.Vector Int
      values = VU.create $ do
        vec <- VUM.replicate n 0
        VU.forM_ operations $ \(p,x) -> 
          VUM.modify vec (+ x) p
        return vec
      result :: VU.Vector Int
      result = VU.create $ do
        vec <- VUM.new n
        let dfs parent q acc = do
              let acc' = acc + values VU.! q
              VUM.write vec q acc'
              forM_ (graph V.! q) $ \i ->
                when (i /= parent) $
                  dfs q i acc'
        dfs (-1) 0 0
        return vec
  mapM_ print $ VU.toList result