#include <bits/stdc++.h>
using namespace std;
template <class t, class u>
bool chmax(t &a, u b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class t, class u>
bool chmin(t &a, u b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
long long modpow(long long x, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * x % ((long long)1e9 + 7);
    x = x * x % ((long long)1e9 + 7);
    b >>= 1;
  }
  return res;
}
long long modinv(long long x) { return modpow(x, ((long long)1e9 + 7) - 2); }
int main() {
  map<long long, long long> m;
  int N, M;
  cin >> N >> M;
  for (int i = 0; i < (N); ++i) {
    long long L, R, D;
    cin >> L >> R >> D;
    if (m.count(L)) {
      if (m.count(R) && m[R] - m[L] != D) {
        cout << "No" << endl;
        return 0;
      }
      m[R] = m[L] + D;
    } else if (m.count(R)) {
      m[L] = m[R] - D;
    } else {
      m[L] = 0;
      m[R] = D;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
