#include <bits/stdc++.h>
using namespace std;
long long int a[100005] = {0};
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    a[i] = LLONG_MAX;
  }
  bool ok = true;
  for (int i = 0; i < m; ++i) {
    long long int l, r, d;
    cin >> l >> r >> d;
    if (!ok) continue;
    if (a[l] == LLONG_MAX && a[r] == LLONG_MAX) {
      a[l] = 0;
      a[r] = d;
    } else if (a[l] == LLONG_MAX) {
      a[l] = a[r] - d;
    } else if (a[r] == LLONG_MAX) {
      a[r] = a[l] + d;
    } else if (a[r] - a[l] != d) {
      ok = false;
    }
  }
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}
