#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;
  int L, R, D;
  cin >> L >> R >> D;
  ll st = 10000000000;
  mp[L] = st;
  mp[R] = mp[L] + D;
  ll r = mp[R], l = mp[L];
  for (int i = 0; i < (int)(M - 1); i++) {
    cin >> L >> R >> D;
    if (mp[L] == 0 && mp[R] == 0) {
      mp[L] = st;
      mp[R] = st + D;
    } else if (mp[L] == 0) {
      mp[L] = mp[R] - D;
    } else if (mp[R] == 0) {
      mp[R] = mp[L] + D;
    } else {
      if (mp[R] - mp[L] != D) {
        cout << "No" << endl;
        return 0;
      }
    }
    r = max(r, mp[R]);
    l = min(l, mp[L]);
  }
  if (r - l > 1e9) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}
