#include <bits/stdc++.h>
int x[100001];
struct cond {
  int l, r, d;
};
int min(int a, int b) { return a < b ? a : b; }
bool comp(cond a, cond b) { return min(a.l, a.r) < min(b.l, b.r); }
cond c[200000];
int main() {
  int N, M, i;
  scanf("%d%d", &N, &M);
  for (i = 1; i <= N; i++) x[i] = -1;
  for (i = 0; i < M; i++) scanf("%d%d%d", &(c[i].l), &(c[i].r), &(c[i].d));
  std::sort(c, c + N, comp);
  for (i = 0; i < M; i++) {
    if (x[c[i].l] == -1) {
      if (x[c[i].r] == -1) {
        x[c[i].l] = 0;
        x[c[i].r] = c[i].d;
      } else {
        x[c[i].l] = x[c[i].r] - c[i].d;
        if (x[c[i].l] < 0) {
          printf("No");
          return 0;
        }
      }
    } else {
      if (x[c[i].r] == -1) {
        x[c[i].r] = x[c[i].l] + c[i].d;
      } else {
        if (x[c[i].r] - x[c[i].l] != c[i].d) {
          printf("No");
          return 0;
        }
      }
    }
  }
  printf("Yes");
  return 0;
}
