#include <bits/stdc++.h>
int main() {
  int i, N, M, L, R, Z, d, f = 0;
  int X[200000];
  scanf("%d%d", &N, &M);
  for (i = 0; i < N; i++) X[i] = 0;
  for (i = 1; i <= M; i++) {
    scanf("%d%d%d", &L, &R, &d);
    if (L > R) {
      Z = L;
      L = R;
      R = Z;
    }
    if ((X[R] - X[L]) != 0) {
      X[R] = X[L] + d;
    } else if ((X[R] - X[L]) != d)
      f = 1;
  }
  if (f)
    printf("No\n");
  else
    printf("Yes\n");
  return 0;
}
