#include <bits/stdc++.h>
using namespace std;
bool check(long long l, long long r, long long d,
           map<long long, long long> &dic) {
  if (dic.count(l)) {
    if (dic.count(r)) {
      if (dic[r] - dic[l] != d) {
        return false;
      }
    } else {
      dic[r] = dic[l] + d;
    }
  } else if (dic.count(r)) {
    dic[l] = dic[r] - d;
  } else {
    dic[l] = 0;
    dic[r] = d;
  }
  return true;
}
long long N, M;
int main(int argc, char const *argv[]) {
  cin >> N >> M;
  map<long long, tuple<long long, long long, long long> > qs;
  multimap<long long, long long> idx;
  for (int i = 0; i < M; ++i) {
    long long l, r, d;
    cin >> l >> r >> d;
    qs.insert(make_pair(i, make_tuple(l, r, d)));
    idx.insert(make_pair(l, i));
    idx.insert(make_pair(r, i));
  }
  map<long long, long long> dic;
  set<long long> used;
  for (auto &&q : qs) {
    auto i = q.first;
    if (used.count(i)) continue;
    used.insert(i);
    auto l = std::get<0>(q.second);
    auto r = std::get<1>(q.second);
    auto d = std::get<2>(q.second);
    if (!check(l, r, d, dic)) {
      cout << "No" << endl;
      return 0;
    }
    auto lqrange = idx.equal_range(l);
    auto rqrange = idx.equal_range(r);
    for (auto it = lqrange.first; it != lqrange.second; ++it) {
      if (used.count(it->second)) continue;
      used.insert(it->second);
      auto q0 = qs[it->second];
      auto l0 = std::get<0>(q0);
      auto r0 = std::get<1>(q0);
      auto d0 = std::get<2>(q0);
      if (!check(l0, r0, d0, dic)) {
        cout << "No" << endl;
        return 0;
      }
    }
    for (auto it = rqrange.first; it != rqrange.second; ++it) {
      if (used.count(it->second)) continue;
      used.insert(it->second);
      auto q0 = qs[it->second];
      auto l0 = std::get<0>(q0);
      auto r0 = std::get<1>(q0);
      auto d0 = std::get<2>(q0);
      if (!check(l0, r0, d0, dic)) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}
