#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
pair<long long, long long> lr[200000];
int main() {
  int n, m;
  cin >> n >> m;
  long long x[100000] = {0};
  long long d[200000] = {0};
  for (int i = 0; i < m; ++i) {
    cin >> lr[i].first >> lr[i].second >> d[i];
    lr[i].first--;
    lr[i].second--;
  }
  sort(lr, lr + n);
  for (int i = 0; i < m; ++i) x[lr[i].second] += d[i];
  int flag = 0;
  for (int i = 0; i < m; ++i) {
    if (x[lr[i].second] - x[lr[i].first] != d[i]) {
      flag = 1;
      break;
    }
  }
  for (int i = n; i >= 0; --i)
    if (x[i] > 1000000000) {
      flag = 1;
      break;
    }
  if (flag)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}
