#include <bits/stdc++.h>
using namespace std;
const int inf = numeric_limits<int>::max() / 4;
const long long linf = numeric_limits<long long>::max() / 4;
const unsigned long long ulinf = numeric_limits<unsigned long long>::max() / 4;
const double pi = acos(-1);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int dx8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
const int dy8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
long long modpow(long long i, long long j) {
  long long tmp = 1;
  while (j) {
    if (j % 2) tmp = ((tmp * i) % (long long)(1e9 + 7));
    i = ((i * i) % (long long)(1e9 + 7));
    j /= 2;
  }
  return tmp;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
vector<string> split(const string &str, char sep) {
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep)) {
    v.push_back(buffer);
  }
  return v;
}
long long n, m;
long long l[200005] = {}, r[200005] = {}, d[200005] = {};
map<long long, long long> v, p;
long long lm, rm;
int main() {
  cin >> n >> m;
  if (m < 2) {
    cout << "Yes" << endl;
    return 0;
  }
  cin >> l[0] >> r[0] >> d[0];
  v[0] = l[0];
  v[d[0]] = r[0];
  p[l[0]] = 0;
  p[r[0]] = d[0];
  lm = 0;
  rm = d[0];
  for (int i = (1); i < (int)(m); i++) {
    cin >> l[i] >> r[i] >> d[i];
    if ((int)p.count(r[i]) == 0 && (int)v.count(p[l[i]] + d[i]) == 0) {
      v[p[l[i]] + d[i]] = r[i];
      p[r[i]] = p[l[i]] + d[i];
      lm = min(lm, p[r[i]]);
      rm = max(rm, p[r[i]]);
      if (rm - lm > 1000000000) {
        cout << "No" << endl;
        return 0;
      }
    } else if ((int)p.count(r[i]) != 0 && v[p[l[i]] + d[i]] == r[i]) {
      v[p[l[i]] + d[i]] = r[i];
      p[r[i]] = p[l[i]] + d[i];
      lm = min(lm, p[r[i]]);
      rm = max(rm, p[r[i]]);
      if (rm - lm > 1000000000) {
        cout << "No" << endl;
        return 0;
      }
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
