#def fun():
import bisect

[N,M]=map(int,raw_input().split())
A=[[] for i in range(N)]
K=[]
#for i in range(1,N+1):
#    A[i]=[]
bignum=-100000000000
C=[bignum for x in range(N+1)]
for i in range(M):
    [L,R,D]=map(int,raw_input().split())
    if L>R:
        [L,R,D]=[R,L,-D]
    A[L].append([R,D])
    #A[R].append([L,-D])
    if L not in K:
        K.append(L)
    #if R not in K:
    #    K.append(R)
#K=A.keys()
K.sort
E=[]
flg=1
while len(K)!=0 or len(E)!=0:
    if len(E)==0:
        k=K.pop(0)
        C[k]=0
    else:
        k=E.pop(0)
    a=A[k]
    for aa in a:
        [n,d]=aa
        if C[n]!=bignum and C[n]!=C[k]+d:
            print "No"
            flg=0
        else:
            C[n]=C[k]+d
        id =min(bisect.bisect_left(K,n),len(K))
        if len(K)!=0 and K[id]==n:
            K=K[:id]+K[id+1:]
            E.append(n)
    if not flg:
        break
if flg:
    print "Yes"
