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