#include <bits/stdc++.h>
using namespace std;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<long long> pos(n, INFL);
  for (int i = 0; i < m; i++) {
    long long l, r, d;
    scanf("%lld %lld %lld", &l, &r, &d);
    l--, r--;
    if (pos[l] == INFL && pos[r] == INFL) {
      pos[l] = 0;
      pos[r] = d;
    } else if (pos[l] == INFL) {
      pos[l] = pos[r] - d;
    } else if (pos[r] == INFL) {
      pos[r] = pos[l] + d;
    } else {
      if (pos[l] + d != pos[r]) {
        puts("No");
        return 0;
      }
    }
  }
  puts("Yes");
  return 0;
}
