#include <bits/stdc++.h>
using namespace std;
long long INF = numeric_limits<long long>::max();
int main() {
  int n, m;
  cin >> n >> m;
  map<int, long long> pos;
  int l, r, d;
  for (int i = 0; i < m; i++) {
    cin >> l >> r >> d;
    auto l_it = pos.find(l);
    auto r_it = pos.find(r);
    if (l_it == pos.end() && r_it == pos.end()) {
      pos[l] = 0;
      pos[r] = d;
    } else if (l_it == pos.end() && r_it != pos.end()) {
      pos[l] = r_it->second - d;
    } else if (l_it != pos.end() && r_it == pos.end()) {
      pos[r] = l_it->second + d;
    } else {
      long long left = l_it->second;
      long long right = r_it->second;
      if (left + d != right) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  long long left = INF, right = -INF;
  for (auto it : pos) {
    left = min(left, it.second);
    right = max(right, it.second);
  }
  if (right - left <= 1e9)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
