#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e11;
const int MOD = 1e9 + 7;
int main(void) {
  int n, m;
  cin >> n >> m;
  vector<long long int> g(n + 1, INF);
  vector<pair<int, pair<int, int> > > path;
  for (int i = 0; i < (int)(m); i++) {
    int l, r, d;
    cin >> l >> r >> d;
    if (l > r) {
      path.push_back(pair<int, pair<int, int> >(r, pair<int, int>(l, -d)));
    } else {
      path.push_back(pair<int, pair<int, int> >(l, pair<int, int>(r, d)));
    }
  }
  sort((path).begin(), (path).end());
  int f = 1;
  long long int mi = 0LL, ma = 0LL;
  for (__typeof((path).begin()) e = (path).begin(); e != (path).end(); ++e) {
    long long int left = (*e).first, right = (*e).second.first,
                  d = (*e).second.second;
    if (g[left] == INF) {
      if (ma - mi > 1e9) f = 0;
      g[left] = 0;
      ma = 0;
      mi = 0;
    }
    if (g[right] == INF) {
      g[right] = g[left] + d;
      ma = max(ma, g[right]);
      mi = min(mi, g[right]);
    } else {
      if (g[right] - g[left] != d) f = 0;
    }
  }
  if ((ma - mi) > 1e9) f = 0;
  cout << (f ? "Yes" : "No") << endl;
  return 0;
}
