import Control.Monad
import Data.IntMap (IntMap, (!))
import qualified Data.IntMap as IM
import Data.Bool
import Data.Maybe

solve :: Int -> IntMap [(Int,Int)] -> Bool
solve n nbr = isJust $ foldM f IM.empty [1..n] where
  f pos i
    | i `IM.member` pos = Just pos
    | otherwise = g i 0 pos
    where
      g i pi pos = foldM h (IM.insert i pi pos) (nbr!i) where
        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 readTripleLn
  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

readTripleLn =
  (\[a,b,c] -> (read a,read b,read c)).words <$> getLine