import Control.Monad
import Control.Applicative
import Data.List
import qualified Data.Map as Map
import Data.Array
strToInt s = (read :: String -> Int) s

main = do

    [n,m] <- (map strToInt . words) <$> getLine
    lrds_ <- replicateM m (map read . words <$> getLine)
    let lrd = crelrd lrds_
    if compli lrd lrds_ n == True
    then putStrLn "Yes"
    else putStrLn "No"
    
compli :: [[Int]] -> [[Int]] -> Int -> Bool
compli cond [] n = True
compli cond (a:an) n = if complia cond a n == False
                       then False
                       else compli cond an n
    
complia :: [[Int]] -> [Int] -> Int -> Bool
complia cond an n = foldr (&&) True [(d cond y x) + (d cond z y) <= (d cond z x) | y <-[0..(n-1)]]
                   where z = an!!1
                         x = an!!0

crelrd :: [[Int]] -> [[Int]]
crelrd [] = []
crelrd (a:an) = [a] ++ [[a!!1,a!!0,(-1)*(a!!2)]] ++ crelrd an

d :: [[Int]] -> Int -> Int -> Int
d cond i j = if [xs!!2 | xs <- cond , xs!!0 == i , xs!!1 ==j] == []
             then 0
             else head  [xs!!2 | xs <- cond , xs!!0 == i , xs!!1 ==j]