import sys
input=sys.stdin.readline
N,M=map(int,input().split())

C=[0 for i in range(N+1)]
L=[[]for i in range(N+1)]
A=[]
for i in range(M):
    l,r,d=map(int,input().split())
    A.append([r,l,d])
A.sort()    

for i in range(M):
    C[A[i][0]]=C[A[i][1]]+A[i][2]
    
for i in range(M):
    if C[A[i][0]]!=C[A[i][1]]+A[i][2]:
        print("No")
        exit()
print("Yes")