#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
typedef struct popo {
  long long l = 0, r = 0, d = 0;
} LR;
LR lr[200000];
int n, m;
int L[100000 + 2], R[100000 + 2];
void merge(LR A[], int n, int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
  for (int i = 0; i < n1; i++) L[i] = A[left + i].l;
  for (int i = 0; i < n2; i++) R[i] = A[mid + i].l;
  L[n1] = R[n2] = (1 << 20);
  int i = 0, j = 0;
  for (int k = left; k < right; k++) {
    if (L[i] <= R[j]) {
      A[k].l = L[i++];
    } else {
      A[k].l = R[j++];
    }
  }
}
void so(LR A[], int n, int left, int right) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    so(A, n, left, mid);
    so(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}
int main() {
  cin >> n >> m;
  long long x[100000] = {0};
  for (int i = 0; i < m; ++i) {
    cin >> lr[i].l >> lr[i].r >> lr[i].d;
    lr[i].l--;
    lr[i].r--;
  }
  so(lr, m, 0, m);
  for (int i = 0; i < m; ++i) x[lr[i].r] = x[lr[i].l] + lr[i].d;
  int flag = 0;
  for (int i = 0; i < m; ++i) {
    if (x[lr[i].r] - x[lr[i].l] != lr[i].d) {
      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;
}
