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