n,m=map(int,input().split())
x=[0]*n
l=[0]*m
r=[0]*m
d=[0]*m
for i in range(m):
  l[i],r[i],d[i]=map(int,input().split())
  x[r[i]-1]=x[l[i]-1]+d[i]
for i in range(m):
  if x[r[i]-1]!=x[l[i]-1]+d[i]:
    print('No')
    exit()
print('Yes')