#include <bits/stdc++.h>
using namespace std;
int n, m;
int l[200000], r[200000], d[200000];
map<int, long long> t;
const long long M = 500000000000;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) t[i] = -M;
  for (int i = 0; i < m; i++) {
    cin >> l[i] >> r[i] >> d[i];
    l[i]--;
    r[i]--;
  }
  bool ok = 1;
  for (int i = 0; i < m; i++) {
    if (t[l[i]] == -M && t[r[i]] == -M) {
      t[l[i]] = M;
      t[r[i]] = d[i] + t[l[i]];
    } else if (t[l[i]] == -M) {
      t[l[i]] = t[r[i]] - d[i];
    } else if (t[r[i]] == -M) {
      t[r[i]] = t[l[i]] + d[i];
    } else {
      if (d[i] != t[r[i]] - t[l[i]]) ok = 0;
    }
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
