func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   const ll LINF = 1001002003004005006ll;   int dx[] = {1, 0, -1, 0};   int dy[] = {0, 1, 0, -1};   ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }   template <class T>   bool chmax(T &a, const T &b) {     if (a < b) {       a = b;       return 1;     }     return 0;   }   template <class T>   bool chmin(T &a, const T &b) {     if (b < a) {       a = b;       return 1;     }     return 0;   }   void solve() {     ll n, m;     cin >> n >> m;     vector<tuple<ll, ll, ll>> v(n);     for (int i = 0; i < n; i++) {       ll t, l, h;       cin >> t >> l >> h;       v[i] = make_tuple(t, l, h);     }     sort(v.begin(), v.end());     ll L = m, H = m, T = 0;     for (int i = 0; i < n; i++) {       ll now = get<0>(v[i]), l = get<1>(v[i]), h = get<2>(v[i]);       L = L - (now - T);       H = H + (now - T);       if (h < L or H < l) {         cout <<  NO  << endl;         return;       }       chmax(L, l);       chmin(H, h);       T = now;     }     cout <<  YES  << endl;     return;   }   signed main() {     cin.tie(0);     ios::sync_with_stdio(0);     int q;     cin >> q;     while (q--) solve();     return 0;   }   