#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1e9 + 7;
static const long long INF = 1e25;
static const long long MAX_N = 100001;
long long p[100001] = {};
vector<pair<long long, pair<long long, long long>>> v;
int main() {
  long long n, m;
  cin >> n >> m;
  if (!m) {
    cout << "Yes" << endl;
    return 0;
  }
  for (int i = 0; i < m; i++) {
    long long l, r, d;
    cin >> l >> r >> d;
    v.push_back({l, make_pair(r, d)});
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < MAX_N; i++) p[i] = -1;
  p[v[0].first] = 0;
  p[v[0].second.first] = v[0].second.second;
  for (int i = 1; i < v.size(); i++) {
    long long L = v[i].first;
    long long R = v[i].second.first;
    long long D = v[i].second.second;
    if (p[L] == -1 && p[R] == -1) {
      p[L] = 0;
      p[R] = D;
    } else if (p[L] != -1 && p[R] == -1) {
      p[R] = p[L] + D;
    } else if (p[L] == -1 && p[R] != -1) {
      p[L] = p[R] - D;
    } else {
      long long x = p[R] - p[L];
      if (x != D) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}
