#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 6;
pair<pair<int, int>, int> pp[N];
vector<pair<int, int> > vec[N];
vector<int> rev[N];
long long int dis[N];
int main() {
  long long int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int l, r, d;
    cin >> l >> r >> d;
    pp[i] = make_pair(make_pair(l, r), d);
    vec[l].push_back(make_pair(r, d));
    rev[r].push_back(l);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < vec[i].size(); j++) {
      int v = vec[i][j].first;
      int w = vec[i][j].second;
      dis[v] = dis[i] + w;
    }
  }
  for (int i = 1; i <= m; i++) {
    int l = pp[i].first.first;
    int r = pp[i].first.second;
    long long int d = pp[i].second, x;
    x = dis[r] - dis[l];
    if (x != d) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}
