n,m=map(int,input().split())
arr=[0]*(n+1)
flag=True
for _ in range(m):
  a,b,d=map(int,input().split())
  if b>a:
    tmp=arr[a]+d
    if arr[b]!=0 and arr[b]!=tmp:
      flag=False
    arr[b]=tmp
  else:
    tmp=arr[b]-d
    if arr[a]!=0 and arr[a]!=tmp:
      flag=False
    arr[a]=tmp
if flag:
  print('Yes')
else:
  print('No')