#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e15 + 7;
int n, m;
long long l, r, d;
long long a[100005];
int main() {
  while (~scanf("%d %d", &n, &m)) {
    for (int i = 0; i <= n; ++i) a[i] = -inf;
    int flag = 0;
    for (int i = 0; i < m; ++i) {
      scanf("%lld %lld %lld", &l, &r, &d);
      if (a[l] == -inf && a[r] == -inf) {
        a[l] = 0;
        a[r] = d;
      } else if (a[l] != -inf && a[r] == -inf)
        a[r] = a[l] + d;
      else if (a[l] == -inf && a[r] != -inf)
        a[l] = a[r] - d;
      else if (a[l] != -inf && a[r] != -inf) {
        if (a[l] + d != a[r]) flag = 1;
      }
    }
    if (!flag)
      printf("Yes\n");
    else
      printf("No\n");
  }
}
