#include <bits/stdc++.h>
using namespace std;
const int MX = 212345;
int n, m;
long long bit[MX];
vector<pair<pair<int, int>, int> > qq;
void update(int id, int v) {
  while (id < MX) {
    bit[id] += v;
    id += (id & -id);
  }
}
long long query(int id) {
  long long sm = 0;
  while (id > 0) {
    sm += bit[id];
    id -= (id & -id);
  }
  return sm;
}
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  if (a.first.second - a.first.first != b.first.second - b.first.first)
    return (a.first.second - a.first.first < b.first.second - b.first.first);
  return (a.first.first < b.first.first);
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  bool flg = true;
  int cc = 0;
  for (int i = 0, l, r, d; i < m; i++) {
    cin >> l >> r >> d;
    if (l > r) swap(l, r);
    qq.push_back(make_pair(make_pair(l, r), d));
  }
  sort(qq.begin(), qq.end(), cmp);
  for (int i = 0; i < m; i++) {
    int l, r, d;
    l = qq[i].first.first;
    r = qq[i].first.second;
    d = qq[i].second;
    long long dl = query(l);
    long long dr = query(r);
    long long cur_d = dr - dl;
    update(r, d - cur_d);
  }
  for (int i = 0; i < m; i++) {
    int l, r, d;
    l = qq[i].first.first;
    r = qq[i].first.second;
    d = qq[i].second;
    long long dl = query(l);
    long long dr = query(r);
    if (d != dr - dl) {
      flg = false;
      break;
    }
  }
  if (flg)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
