n,m = gets.chomp.split.map(&:to_i)
p = {}
m.times do
  l,r,d = gets.chomp.split.map(&:to_i)
  if !p[l] && !p[r]
    p[l] = 0
    p[r] = d
  elsif !p[l]
    p[l] = p[r] - d
  elsif !p[r]
    p[r] = p[l] + d
  else
    if d != p[r] - p[l]
      printf("No\n")
      exit
    end
  end
end
printf("Yes\n")