{-# OPTIONS_GHC -O #-}

import Control.Monad
import Control.Monad.ST
import Data.List
import qualified Data.Vector.Unboxed.Mutable as VM
import qualified Data.ByteString.Char8 as B
import qualified Data.IntMap as M

main = do
    (n:m:_)<-map read.words<$>getLine::IO [Int]
    lrds <- replicateM m $ unfoldr (B.readInt.B.dropWhile(==' ')) <$> B.getLine :: IO[[Int]]
    let grp = foldl (\m (l:r:d:_)->M.alter (ins l (-d)) r $ M.alter (ins r d) l m) M.empty lrds
    putStrLn $ if solve n grp lrds then "Yes" else "No"
--
ins ::Int -> Int -> Maybe [(Int,Int)] -> Maybe [(Int,Int)]
ins n w Nothing = Just [(n,w)]
ins n w (Just nws) = Just ((n,w):nws)
--
solve :: Int -> M.IntMap [(Int,Int)] -> [[Int]] -> Bool
solve n grp lrds = runST $ do
    ckd <- VM.replicate (n+1) False :: ST s (VM.STVector s Bool)
    dst <- VM.replicate (n+1) 0 :: ST s (VM.STVector s Int)
    fmap and $ forM [1..n] $ \i -> do
        d <- VM.unsafeRead dst i
        dfs grp ckd dst True (i,d)
--
dfs :: M.IntMap [(Int,Int)] -> VM.STVector s Bool -> VM.STVector s Int -> Bool -> (Int,Int) -> ST s Bool
dfs grp ckd dst ac (x,d) = do
    c <- VM.unsafeRead ckd x
    dd <- VM.unsafeRead dst x
    if c then return $ ac && dd==d
    else do
        VM.unsafeWrite ckd x True
        VM.unsafeWrite dst x d
        foldM (dfs grp ckd dst) ac $ map (\(u,v)->(u, v+d)) $ M.findWithDefault [] x grp
