#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[120] = {0};
  int n, m;
  cin >> n >> m;
  int r, l, d, mi = 9999, mx = -1;
  while (m--) {
    cin >> l >> r >> d;
    if (a[r] == 0) {
      a[r] = a[l] + d;
    } else if (a[r] != a[l] + d) {
      cout << "No" << endl;
      return 0;
    }
    mi = min(mi, a[l]);
    mx = max(mx, a[r]);
    if (mx - mi > 109) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}
