n,m=map(int,input().split())
l=[0 for _ in range(n+1)]
for _ in range(m):
  a,b,c=map(int,input().split())
  if a>b:
    a,b=b,a
    c=-c
  if not (l[a]!=0 and l[b]!=0):
    if not l[a]:
      l[a]=1
    l[b]=l[a]+c
  else:
    if (b-a)!=c:
      print("No")
      break
else:
  print("Yes")