#include <bits/stdc++.h>
int p[100005];
int main() {
  int n, m, i, l, r, d, t, s;
  scanf("%d %d", &n, &m);
  if (m == 0) {
    printf("Yes\n");
    return 0;
  }
  scanf("%d %d %d", &l, &r, &d);
  s = l;
  p[l] = 0;
  p[r] = p[l] + d;
  for (i = 1; i < m; i++) {
    scanf("%d %d %d", &l, &r, &d);
    t = p[l] + d;
    if (p[r] == 0) {
      if (r != s)
        p[r] = t;
      else {
        if (p[r] != t) {
          printf("No\n");
          return 0;
        }
      }
    } else {
      if (p[r] != t) {
        printf("No\n");
        return 0;
      }
    }
  }
  printf("Yes\n");
  return 0;
}
