def main()
  n, m = gets.split.map { |t| t.to_i }
  loc_info = []
  m.times do
    loc_info.push(gets.split.map { |t| t.to_i })
  end
  # Sort by the person number.
  loc_info.sort_by! { |t| [t[0], t[1]].min }
  loc_hash = {}
  for left, right, dist in loc_info
    if loc_hash[left]
      if loc_hash[right]
        if loc_hash[right] != loc_hash[left] + dist
          puts "No"
          exit
        end
      else
        loc_hash[right] = loc_hash[left] + dist
      end
    else
      if loc_hash[right]
        loc_hash[left] = loc_hash[right] - dist
      else
        loc_hash[left] = 0
        loc_hash[right] = loc_hash[left] + dist
      end
    end
  end
  puts "Yes"
end

main if __FILE__ == $0
