#include <bits/stdc++.h>
using namespace std;
long long int e_bit = 0xAAAAAAAA;
long long int o_bit = 0x55555555;
long double pi = acos(-1.0);
long long int gprime = 402653189;
long long int pprime = 1610612741;
long long int dulo = 1000000007;
bool is_power2(long long int n) { return (n && !(n & (n - 1))); }
long long int power(long long int x, long long int y) {
  long long int temp;
  if (y == 0) return 1;
  temp = power(x, y / 2);
  if (y % 2 == 0)
    return (temp * temp);
  else {
    if (y > 0)
      return (((x * temp)) * temp);
    else
      return (temp * temp) / x;
  }
}
long long int mul_inv(long long int n, long long int p, long long int m) {
  if (p == 1) {
    return n % m;
  } else if (p % 2 == 0) {
    long long int t = mul_inv(n, p / 2, m);
    return ((t) * (t)) % m;
  } else {
    long long int t = mul_inv(n, p / 2, m);
    return ((((n % m) * t) % m) * t) % m;
  }
}
bool isprime(long long int n) {
  if (n == 1) {
    return false;
  }
  if (n == 2) {
    return true;
  }
  if (n % 2 == 0) {
    return false;
  }
  for (long long int i = 3; i <= sqrt(n); i += 2) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  long long int pos[n];
  for (int i = 0; i < n; i++) pos[i] = 1e16;
  int flag = 1;
  for (int i = 0; i < m; i++) {
    int l, r, d;
    cin >> l >> r >> d;
    l--;
    r--;
    if (pos[l] == 1e16 && pos[r] == 1e16) {
      pos[r] = 1e11;
      pos[l] = 1e11 - d;
    } else if (pos[l] == 1e16) {
      pos[l] = pos[r] - d;
    } else if (pos[r] == 1e16) {
      pos[r] = pos[l] + d;
    } else {
      if (pos[r] - pos[l] != d) {
        flag = 0;
      }
    }
  }
  if (m == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  if (flag == 0) {
    cout << "No" << endl;
    return 0;
  }
  long long int mi = 1e16, ma = 0;
  for (int i = 0; i < n; i++) {
    if (pos[i] != 1e16) {
      mi = min(pos[i], mi);
      ma = max(pos[i], ma);
    }
  }
  if (ma - mi <= 1e9) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}
