#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.second - a.first.first) == (b.first.second - b.first.first)) {
    if (a.first.first == b.first.first)
      return a.first.second <= b.first.second;
    else
      return a.first.first <= b.first.first;
  } else
    return (a.first.second - a.first.first) < (b.first.second - b.first.first);
}
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> > info;
  for (long long i = (long long)0; i < (long long)M; i++) {
    long long l, r, d;
    cin >> l >> r >> d;
    if (l > r) {
      swap(l, r);
      d = -d;
    }
    info.push_back(make_pair(make_pair(l, r), d));
  }
  sort(info.begin(), info.end(), func);
  for (long long i = (long long)0; i < (long long)info.size(); i++) {
    long long l, r, d;
    l = info[i].first.first;
    r = info[i].first.second;
    d = info[i].second;
    if (P[l] == 0) P[l] = 10000000000;
    long long des = P[l] + d;
    if (P[r] == 0)
      P[r] = des;
    else if (P[r] == des)
      continue;
    else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
