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