#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100050;
const long long INF = 1e18;
int n, m;
long long x[MAX_N];
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = (0); i < (MAX_N); ++i) x[i] = INF;
  vector<long long> r(m);
  vector<long long> l(m);
  vector<long long> d(m);
  for (int i = (0); i < (m); ++i) {
    cin >> l[i] >> r[i] >> d[i];
  }
  vector<int> order(m);
  for (int i = (0); i < (m); ++i) {
    order[i] = i;
  }
  sort(order.begin(), order.end(), [&](int x, int y) {
    if (l[x] == l[y]) return r[x] < r[y];
    return l[x] < l[y];
  });
  for (int i = (0); i < (m); ++i) {
    int idx = order[i];
    int L = l[idx];
    int R = r[idx];
    long long D = d[idx];
    if (x[L] == INF && x[R] == INF) {
      x[L] = 0;
      x[R] = D;
    } else if (x[L] == INF) {
      x[L] = x[R] - D;
    } else if (x[R] == INF) {
      x[R] = x[L] + D;
    } else {
      if (x[R] - x[L] != D) {
        cout << "No" << '\n';
        return 0;
      }
    }
  }
  cout << "Yes" << '\n';
  return 0;
}
