#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n + 5];
  bool f[n + 5], t = 1;
  memset(a, 0, sizeof(a));
  memset(f, 0, sizeof(f));
  for (int i = 1; i <= m; i++) {
    int r, l, d;
    cin >> r >> l >> d;
    if (i == 1) {
      a[r] = 100;
      f[r] = 1;
    }
    int x = r + d;
    if (x != a[l] && f[l]) {
      t = 0;
      cout << "No" << endl;
      return 0;
    } else {
      a[l] = x;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
