import Control.Monad
import Data.IntMap (IntMap, (!))
import qualified Data.IntMap as IM
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Bool
import Data.Maybe

-- 人数 -> (人i → (人j, 距離)) -> 答え 
solve :: Int -> IntMap [(Int,Int)] -> Bool
solve n nbr = isJust $ foldM f IM.empty [1..n] where
  -- Maybe (人→座標) -> 人i -> Maybe (人→座標)
  -- i の 位置が規定なら何もしない
  -- i の 位置が未定なら，0におく．矛盾なら Nothing
  f pos i
    | i `IM.member` pos = Just pos
    | otherwise = g i 0 pos
    where
      -- 人i -> 人iの座標pi -> Maybe (人→座標)
      -- 人i を pi におく．矛盾なら Nothing
      g i pi pos = foldM h (IM.insert i pi pos) (nbr!i) where
        -- (人→座標) -> (人j, 距離) -> Maybe (人→座標)
        -- 人j を 人i との距離情報に従っておく．矛盾なら Nothing
        h pos (j, d)
          | j `IM.member` pos =
              bool Nothing (Just pos) (pos!j == pj)
          | otherwise = g j pj pos
          where pj = pi + d

main :: IO ()
main = do
  [n,m] <- map read.words <$> getLine
  edge <- replicateM m readIntsLn
  let
    nbr = foldr f emps edge
    f [l,r,d] nbr
      = IM.adjust ((r,d):) l $ IM.adjust ((l,-d):) r nbr
    emps = IM.fromDistinctAscList $ zip [1..n] $ repeat [] 
  putStrLn $ bool "No" "Yes" $ solve n nbr

readIntsLn
  = unfoldr (B.readInt . B.dropWhile(==' ')) <$> B.getLine