#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll mod = 1e9 + 7;
const int INF = 1e9;
const int MAX_N = 100000;
int main() {
  cin.sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  if (M == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  map<int, ll> mp;
  vector<int> R(M), L(M), D(M);
  cin >> L[0] >> R[0] >> D[0];
  ll st = 10000000000;
  mp[L[0]] = st;
  mp[R[0]] = mp[L[0]] + D[0];
  ll r = mp[R[0]], l = mp[L[0]];
  for (int i = 0; i < (int)(M - 1); i++) {
    if (mp[L[i]] == 0 && mp[R[i]] == 0) {
      mp[L[i]] = st;
      mp[R[i]] = st + D[i];
    } else if (mp[L[i]] == 0) {
      mp[L[i]] = mp[R[i]] - D[i];
    } else if (mp[R[i]] == 0) {
      mp[R[i]] = mp[L[i]] + D[i];
    } else {
      if (mp[R[i]] - mp[L[i]] != D[i]) {
        cout << "No" << endl;
        return 0;
      }
    }
    r = max(r, mp[R[i]]);
    l = min(l, mp[L[i]]);
  }
  for (int i = 0; i < (int)(M); i++) {
    if (mp[L[i]] == 0 && mp[R[i]] == 0) {
      mp[L[i]] = st;
      mp[R[i]] = st + D[i];
    } else if (mp[L[i]] == 0) {
      mp[L[i]] = mp[R[i]] - D[i];
    } else if (mp[R[i]] == 0) {
      mp[R[i]] = mp[L[i]] + D[i];
    } else {
      if (mp[R[i]] - mp[L[i]] != D[i]) {
        cout << "No" << endl;
        return 0;
      }
    }
    r = max(r, mp[R[i]]);
    l = min(l, mp[L[i]]);
  }
  if (r - l > 1e9 || r < l) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}
