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