import Control.Monad
import Data.IntMap (
  IntMap, (!), member, insert, adjust, fromList, empty)
import Data.Bool
import Data.Maybe

solve :: Int -> IntMap [(Int,Int)] -> Bool
solve n nbr = isJust $ foldM f empty [1..n] where
  f pos i
    | i `member` pos = Just pos
    | otherwise = g i 0 pos
    where
      g i pi pos = foldM h (insert i pi pos) (nbr!i) where
        h pos (j, d)
          | j `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
  nbr <- buildNbrMap n <$> replicateM m readTripleLn
  putStrLn $ bool "No" "Yes" $ solve n nbr

buildNbrMap :: Int -> [(Int,Int,Int)] -> IntMap [(Int,Int)]
buildNbrMap n [] = fromList $ zip [1..n] $ repeat []
buildNbrMap n ((l,r,d):rest) =
  adjust ((r,d):) l $ adjust ((l,-d):) r $ buildNbrMap n rest 

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