#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 10, mod = 1e9 + 7;
long long n, m;
map<long long, long long> x;
bool has[maxn];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  while (m--) {
    long long l, r, d;
    cin >> l >> r >> d;
    if (!has[l] && !has[r]) {
      x[l] = 0;
      x[r] = d;
      has[l] = has[r] = 1;
    } else if (has[l] && has[r]) {
      if (x[r] - x[l] != d) return cout << "No" << endl, 0;
    } else {
      if (has[l])
        x[r] = x[l] + d, has[r] = 1;
      else
        x[l] = x[r] - d, has[l] = 1;
    }
  }
  long long mini = 0, maxi = 0;
  for (long long i = 1; i <= n; i++) {
    if (i == 1)
      mini = x[i], maxi = x[i];
    else {
      mini = min(mini, x[i]);
      maxi = max(maxi, x[i]);
    }
  }
  cout << (maxi - mini <= (long long)(1e9) ? "Yes" : "No") << endl;
  return 0;
}
