#include <bits/stdc++.h>
using namespace std;
long long int a[100005];
long long int m1[100005], m2[100005];
signed main() {
  long long int n, m;
  scanf("%lld", &(n));
  scanf("%lld", &(m));
  long long int flag = 0;
  for (long long int i = 1; i <= n; i++)
    a[i] = m2[i] = 1000000007, m1[i] = -1000000007;
  for (long long int i = 0; i < m; i++) {
    long long int l, r, d;
    scanf("%lld", &(l));
    scanf("%lld", &(r));
    scanf("%lld", &(d));
    if (a[l] == 1000000007 && a[r] == 1000000007) {
      a[l] = 0;
      a[r] = d;
    } else if (a[l] == 1000000007)
      a[l] = a[r] - d;
    else if (a[r] == 1000000007)
      a[r] = a[l] + d;
    else {
      if ((a[r] - a[l]) != d) {
        flag = 1;
        break;
      }
    }
    m1[l] = max(a[l], m1[l]);
    m2[l] = min(a[l], m2[l]);
    m1[r] = max(a[r], m1[r]);
    m2[r] = min(a[r], m2[r]);
  }
  for (long long int i = 1; i <= n; i++) {
    if (m1[i] == -1000000007) continue;
    if (m1[i] - m2[i] > 1000000000) {
      flag = 1;
      break;
    }
  }
  if (flag == 1)
    cout << "No";
  else
    cout << "Yes";
  return 0;
}
