#include <bits/stdc++.h>
using namespace std;
template <typename X>
bool exist(vector<X> vec, X item) {
  return find(vec.begin(), vec.end(), item) != vec.end();
}
long long P[100010];
bool func(pair<pair<long long, long long>, long long> a,
          pair<pair<long long, long long>, long long> b) {
  if (a.first.first != b.first.first)
    return a.first.first < b.first.first;
  else
    return a.first.second < b.first.second;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, M;
  cin >> N >> M;
  vector<pair<pair<long long, long long>, long long> > inf;
  for (long long i = (long long)0; i < (long long)M; i++) {
    long long l, r, d;
    cin >> l >> r >> d;
    if (r < l)
      inf.push_back(make_pair(make_pair(r, l), -d));
    else
      inf.push_back(make_pair(make_pair(l, r), d));
  }
  sort(inf.begin(), inf.end(), func);
  for (long long i = (long long)0; i < (long long)M; i++) {
    long long L = inf[i].first.first;
    long long R = inf[i].first.second;
    long long D = inf[i].second;
    if (P[R] != 0) {
      if (P[L] == 0)
        continue;
      else if (P[R] - P[L] != D) {
        cout << "No" << endl;
        return 0;
      } else
        continue;
    }
    P[R] = P[L] + D;
  }
  for (long long i = (long long)0; i < (long long)M; i++) {
    long long L = inf[i].first.first;
    long long R = inf[i].first.second;
    long long D = inf[i].second;
    if (P[R] - P[L] != D) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
