N,M = map(int,input().split())
A = ["#" for i in range(N+1)]

ans = "Yes"

for i in range(M) :
    l,r,d = map(int,input().split())
    
    if l > r :
        l,r = r,l
        d *= -1
    
    if i == 0 :
        A[l] = 0
        A[r] = d
    
    elif A[l] == "#" :
        continue
    
    elif A[r] == "#" :
        if A[l] == "#" :
            continue
        
        A[r] = A[l] + d
    
    else :
        if A[r] != A[l] + d :
            ans = "No"
            break

print(ans)
