#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  void solve(std::istream& in, std::ostream& out) {
    long long n, m;
    in >> n >> m;
    long long idx = n * m;
    map<long long, long long> zip;
    bool ok = true;
    for (long long i = 0; i < m; i++) {
      long long l, r, d;
      in >> l >> r >> d;
      if (!zip[l] && !zip[r]) {
        zip[l] = idx;
        idx += d;
        zip[r] = idx;
        idx++;
      } else if (!zip[l]) {
        zip[l] = zip[l] - d;
      } else if (!zip[r]) {
        zip[r] = zip[l] + d;
      } else {
        if (zip[r] - zip[l] != d) {
          ok = false;
          break;
        }
      }
    }
    out << (ok ? "Yes" : "No") << endl;
  }
};
void solve(std::istream& in, std::ostream& out) {
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  ostream& out = cout;
  solve(in, out);
  return 0;
}
