#include <bits/stdc++.h>
struct {
  int next;
  int prev;
  int dist;
} mMen[100001] = {0};
int p(int a) {
  while (mMen[a].prev > 0) {
    a = mMen[a].prev;
  }
  return a;
}
void q(int l, int r, int d, int pl, int pr) {
  int x;
  int i, il, ir;
  x = mMen[l].dist + d - mMen[r].dist;
  for (ir = pr; ir > 0; ir = mMen[ir].next) {
    mMen[ir].dist += x;
  }
  if (mMen[pl].dist < mMen[pr].dist) {
    i = pl;
    il = mMen[pl].next;
    ir = pr;
  } else {
    i = pr;
    il = pl;
    ir = mMen[pr].next;
  }
  for (;;) {
    if (il == 0) {
      mMen[i].next = ir;
      mMen[ir].prev = i;
      break;
    } else if (ir == 0) {
      mMen[i].next = il;
      mMen[il].prev = ir;
      break;
    } else if (mMen[il].dist < mMen[ir].dist) {
      mMen[i].next = il;
      mMen[il].prev = i;
      i = il;
      il = mMen[il].next;
    } else {
      mMen[i].next = ir;
      mMen[ir].prev = i;
      i = ir;
      ir = mMen[ir].next;
    }
  }
}
int main(void) {
  int n;
  int m;
  int i;
  char *pYes = "Yes", *pNo = "No", *pAns = pYes;
  scanf("%d%d", &n, &m);
  for (i = 0; i < m; ++i) {
    int l, r, pl, pr;
    int d;
    scanf("%d%d%d", &l, &r, &d);
    pl = p(l);
    pr = p(r);
    if (pl != pr) {
      q(l, r, d, pl, pr);
    } else {
      if (mMen[r].dist - mMen[l].dist != d) {
        pAns = pNo;
        break;
      }
    }
  }
  printf("%s\n", pAns);
  return 0;
}
