#include <bits/stdc++.h>
using namespace std;
int N, M;
map<long long, long long> pos;
map<pair<int, int>, int> all_pair;
int main() {
  cin >> N >> M;
  int L, R, D;
  for (int i = 0; i < M; i++) {
    cin >> L >> R >> D;
    pair<int, int> p = make_pair(L, R);
    all_pair[p] = D;
  }
  long long current_max = -1;
  for (const auto& i : all_pair) {
    long long l_n = i.first.first;
    long long r_n = i.first.second;
    long long dis = i.second;
    if (pos.count(l_n) == 0) {
      pos[l_n] = current_max;
    }
    long long new_pos = pos[l_n] + dis;
    if (pos.count(r_n) == 0) {
      pos[r_n] = new_pos;
    } else {
      if (pos[r_n] != new_pos) {
        cout << "No" << endl;
        return 0;
      }
    }
    current_max = new_pos;
  }
  cout << "Yes" << endl;
  return 0;
}
