--{-# LANGUAGE OverloadedStrings #-}
--{-# LANGUAGE OverloadedLists   #-}
{-# LANGUAGE BangPatterns      #-} --引数に!
{-# LANGUAGE MultiWayIf        #-}
{-# LANGUAGE TupleSections     #-}

import Data.Graph
import Data.Bits
import Data.Foldable (foldlM,foldrM)
import Data.Maybe (fromJust)
import Data.List
import Data.Array as A
import Data.Array.MArray
import Data.Array.ST
import Control.Monad
import Control.Monad.ST
import qualified Data.Vector.Unboxed.Mutable as V
import Data.Vector.Unboxed as U (toList,freeze,(!),Vector)
import Debug.Trace

type Ans = Int

f :: Graph -> U.Vector Int -> [(Int,Int)]
f graph vec = sub 1 0
  where
    sub p s = (p,(s+(vec U.! p))) : (concat [sub np (s+(vec U.! p)) | np <- (graph A.! p)])

solve :: Graph -> Int -> Int -> IO [(Int,Int)]
solve graph n q = do
  vec <- V.replicate (n+1) 0
  replicateM_ q $ do
    [p,x] <- map read. words <$> getLine :: IO [Int]
    V.modify vec (+x) p
  vec' <- U.freeze vec
  return $ f graph vec'


main :: IO ()
main = do
  [n,q] <- map read.words <$> getLine :: IO [Int]
  ls <- replicateM (n-1) $ do
    [a,b] <- map read. words <$> getLine :: IO [Int]
    return (a,b)
  anss <- solve (buildG (1,n) ls) n q

  --forM_ (sortOn fst anss) $ \v -> putStr $ (show v) ++ " "
  forM_ (sortOn fst anss) $ \(_,v) -> putStr $ (show v) ++ " "
  putStrLn ""
