import Control.Applicative
import Control.Monad
import qualified Data.IntSet as IS
import qualified Data.IntMap as IM

data Spectrum = Spectrum (IM.IntMap Int) | Info Int

main :: IO()
main = do
    [n,m] <- map read . words <$> getLine
    lrds <- replicateM m $ map read . words <$> getLine
    putStrLn $ isCons (IM.fromSet (\k -> Spectrum (IM.singleton k 0)) (IS.fromList [1..n])) lrds
        where
            isCons :: IM.IntMap Spectrum -> [[Int]] -> String
            isCons _ [] = "Yes"
            isCons m ([l,r,d]:lrds)
                | or (IM.intersectionWith (/=) lm' rm') = "No"
                | otherwise = isCons (IM.insert ri (Info li) $ IM.insert li (Spectrum (IM.union lm' rm')) m) lrds
                where
                    (li,lm,lx) = find m l l
                    (ri,rm,rx) = find m r r
                    lm' = fmap (+rx) lm
                    rm' = fmap (+(lx+d)) rm
                    find m a i =
                        case m IM.! a of
                            Spectrum am -> (a, am, am IM.! i)
                            Info a' -> find m a' i
