#include <bits/stdc++.h>
#define lli long long int
#define li long int
#define MOD 1000000007
#define nl "\n"
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int main()
{
    fastIO;
    int q;
    cin>>q;
    while(q--)
    {
        int n,i,ans=0;
        lli m,t=0;
        cin>>n>>m;
        vector<pair<lli,lli>> vp;
        vp.pb(mp(m,m));
        for(i=1;i<=n;i++)
        {
            lli tc,lc,hc,maxi,mini;
            cin>>tc>>lc>>hc;
            mini = vp[i-1].ff - (tc-t);
            maxi = vp[i-1].ss + (tc-t);
            t = tc;
            if(ans == -1)
                continue;
            if(lc>maxi || hc<mini)
            {
                ans = -1;
                continue;
            }
            if(lc<=mini && hc>=maxi)
                vp.pb(mp(mini,maxi));
            else if(lc<=mini)// && hc<=maxi)
                vp.pb(mp(mini,hc));
            else if(hc>=maxi)// && lc>=mini)
                vp.pb(mp(lc,maxi));
            else// if(lc>=mini && hc=<maxi)
                vp.pb(mp(lc,hc));
        }
        if(ans == -1)
            cout<<"NO"<<nl;
        else
            cout<<"YES"<<nl;
    }
}


#include <bits/stdc++.h>
#define lli long long int
#define li long int
#define MOD 1000000007
#define nl "\n"
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int main()
{
    fastIO;
    int q;
    cin>>q;
    while(q--)
    {
        int n,i,ans=0;
        lli m,t=0,l,h;
        cin>>n>>m;
        l = h = m;
        for(i=0;i<n;i++)
        {
            lli tc,lc,hc,l1,l2,l3,h1,h2,h3,pair=0,count=0;
            cin>>tc>>lc>>hc;
            if(ans == -1)
                continue;
            l1 = l;
            h1 = h;
            l2 = l + abs(t-tc);
            h2 = h + abs(t-tc);
            l3 = l - abs(t-tc);
            h3 = h - abs(t-tc);
            if(h1 >= lc)
            {
                    pair = 1;
                    if(l1 > hc)
                        count++;
            }
            if(h2 >= lc)
            {
                    pair = 1;
                    if(l2 > hc)
                        count++;
            }
            if(h3 >= lc)
            {
                    pair = 1;
                    if(l3 > hc)
                        count++;
            }
            if(pair==0 || count==3)
                ans = -1;
            t = tc;
            l = lc;
            h = hc;
        }
        if(ans == -1)
            cout<<"NO"<<nl;
        else
            cout<<"YES"<<nl;
    }
}


#include <bits/stdc++.h>
#define lli long long int
#define li long int
#define MOD 1000000007
#define nl "\n"
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int main()
{
    fastIO;
    int q;
    cin>>q;
    while(q--)
    {
        int n,i,ans=0;
        lli m,t=0,l,h,maxi,mini,tc_max=0;
        cin>>n>>m;
        l = h = m;
        maxi = mini = m;
        for(i=0;i<n;i++)
        {
            lli tc,lc,hc,l1,l2,l3,h1,h2,h3,pair=0,count=0;
            cin>>tc>>lc>>hc;
            if(tc > tc_max)
            {
            	maxi += (tc-tc_max);
                mini -= (tc-tc_max);
            }
            if(lc>maxi || hc<mini)
            {
            	ans = -1;
            	continue;
            }
            if(ans == -1)
                continue;
            l1 = l;
            h1 = h;
            l2 = l + abs(t-tc);
            h2 = h + abs(t-tc);
            l3 = l - abs(t-tc);
            h3 = h - abs(t-tc);
            t = tc;
            l = lc;
            h = hc;
            if(h1==lc || h2==lc || h3==lc)
            	continue;
            if(l1==hc || l2==hc || l3==hc)
            	continue;
            if(l1==lc || l2==lc || l3==lc)
            	continue;
            if(h1==hc || h2==hc || h3==hc)
            	continue;
            if(h1 > lc)
            {
                    pair = 1;
                    if(l1 > hc)
                        count++;
            }
            if(h2 > lc)
            {
                    pair = 1;
                    if(l2 > hc)
                        count++;
            }
            if(h3 > lc)
            {
                    pair = 1;
                    if(l3 > hc)
                        count++;
            }
            if(pair==0 || count==3)
                ans = -1;
        }
        if(ans == -1)
            cout<<"NO"<<nl;
        else
            cout<<"YES"<<nl;
    }
}


#include<bits/stdc++.h>

#define     ll      long long
#define     pb      push_back
#define     eps     1e-9
#define     ff      first
#define     ss      second
#define     pi      acos(-1)
#define     Fast_Read                    ios_base::sync_with_stdio(false); cin.tie(nullptr);  cout.tie(nullptr);
#define     Precision(x)                 cout.setf(ios::fixed); cout.precision(x);

using namespace std;
typedef long double ld;
#ifdef ARnAb
        #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
        template < typename Arg1 >
        void __f(const char* name, Arg1&& arg1)
        {
            cerr << name << " is " << arg1 << std::endl;
        }
        template < typename Arg1, typename... Args>
        void __f(const char* names, Arg1&& arg1, Args&&... args)
        {
            const char* comma = strchr(names+1, ',');
            cerr.write(names, comma - names) << " is " << arg1 <<"  ";
            __f(comma+1, args...);
        }
#else
#define debug(...)
#endif
///******************************************START******************************************
int cs=0;
void solve()
{
    int n,t;
    cin>>n>>t;
    int prevtime=0,mntemp=t,mxtemp=t;
    for(int i=0; i<n; i++)
    {
        int time, l,r;
        cin>>time>>l>>r;
        int timedif=time-prevtime;
        if(l>mxtemp)
        {
            if(abs(l-mxtemp)>timedif)
            {
                cout<<"NO"<<endl;
                return;
            }
            else
            {
                mxtemp=min(mxtemp+timedif,r);
                mntemp=l;
            }
        }
        else if(r<mntemp)
        {
            if(abs(mntemp-r)>timedif)
            {
                cout<<"NO"<<endl;
                return;
            }
            else
            {
                mntemp=max(mntemp-timedif,l);
                mxtemp=r;
            }
        }
        else
        {
            mntemp=max(mntemp-timedif,l);
            mxtemp=min(mxtemp+timedif,r);
        }
        prevtime=time;
    }
    cout<<"YES"<<endl;
}
int main()
{
    Fast_Read
    Precision(2)
#ifdef ARnAb
    double start_time = clock();
    ///freopen ("output.txt","w",stdout);
    ///freopen ("input.txt","r",stdin);
#endif
    int tc=1;
    cin>>tc;
    while(tc--)
        solve();
    return 0;
}


#include<bits/stdc++.h>

#define     ll      long long
#define     pb      push_back
#define     eps     1e-9
#define     ff      first
#define     ss      second
#define     pi      acos(-1)
#define     Fast_Read                    ios_base::sync_with_stdio(false); cin.tie(nullptr);  cout.tie(nullptr);
#define     Precision(x)                 cout.setf(ios::fixed); cout.precision(x);

using namespace std;
typedef long double ld;
#ifdef ARnAb
        #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
        template < typename Arg1 >
        void __f(const char* name, Arg1&& arg1)
        {
            cerr << name << " is " << arg1 << std::endl;
        }
        template < typename Arg1, typename... Args>
        void __f(const char* names, Arg1&& arg1, Args&&... args)
        {
            const char* comma = strchr(names+1, ',');
            cerr.write(names, comma - names) << " is " << arg1 <<"  ";
            __f(comma+1, args...);
        }
#else
#define debug(...)
#endif
///******************************************START******************************************
int cs=0;
void solve(){
    int n;
    ll m;
    cin>>n>>m;
    ll mx=m,mn=m;
    ll difer=0;
    for(int i=0;i<n;i++){
        ll a,b,c;
        cin>>a>>b>>c;
        difer=a-difer;
        mx+=difer;
        mn-=difer;
        difer=a;
        mx=min(c,mx);
        mn=max(b,mn);
        if(mx>=b && mx<=c && mn>=b && mn<=c) continue;
        cout<<"NO"<<endl;
        return;

    }
    cout<<"YES"<<endl;
}
int main()
{
    Fast_Read
    Precision(2)
#ifdef ARnAb
    double start_time = clock();
    ///freopen ("output.txt","w",stdout);
    ///freopen ("input.txt","r",stdin);
#endif
    int tc=1;
    cin>>tc;
    while(tc--)
        solve();
    return 0;
}


#include<bits/stdc++.h>

#define     pb      push_back
#define     eps     1e-9
#define     ff      first
#define     ss      second
#define     pi      acos(-1)
#define     inf     INT_MAX/2;
#define     INF     LLONG_MAX/2;
#define     mset(a,x)                    memset(a,(x),sizeof(a))
#define     all(x)                       x.begin(),x.end()
#define     allr(x)                      x.rbegin(),x.rend()
#define     Fast_Read                    ios_base::sync_with_stdio(false); cin.tie(nullptr);  cout.tie(nullptr);
#define     Precision(x)                 cout.setf(ios::fixed); cout.precision(x);

using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vii;
typedef vector<ll> vll;
template < class T> inline T biton(T n,T pos){return n ((T)1<<pos);}
template < class T> inline T bitoff(T n,T pos){return n & ~((T)1<<pos);}
template < class T> inline T ison(T n,T pos){return (bool)(n & ((T)1<<pos));}
template < class T> inline T gcd(T a, T b){while(b){a%=b;swap(a,b);}return a;}
inline int nxt(){int aaa;scanf("%d",&aaa);return aaa;}
inline ll lxt(){ll aaa;scanf("%lld",&aaa);return aaa;}
inline double dxt(){double aaa;scanf("%lf",&aaa);return aaa;}
inline void vinput(int n,vector<int> &v){ for(int in,i=0;i<n;i++){cin>>in; v.push_back(in);} }
inline void vout(vector<int> v){ for(auto it:v) cout<<it<<" "; cout<<endl; }
#ifdef ARnAb
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " is " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cerr.write(names, comma - names) << " is " << arg1 <<"  ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************
int cs=0;
void solve()
{
    int n,m;
    cin>>n>>m;
    int prevt=0,low=m,high=m;
    bool ok=true;
    for(int i=0;i<n;i++)
    {
        int t,l,h;
        cin>>t>>l>>h;
        int d=t-prevt;
        low=max(low-d,l);
        high=min(high+d,h);
        if(low>high)    ok=false;
        prevt=t;
    }
    if(ok)  cout<<"YES"<<endl;
    else    cout<<"NO"<<endl;
}
int main()
{
    Fast_Read
    Precision(2)
    #ifdef ARnAb
        double start_time = clock();
        ///freopen ("output.txt","w",stdout);
        ///freopen ("input.txt","r",stdin);
    #endif
    int tc=1;
    cin>>tc;
    while(tc--)
        solve();
    return 0;
}


#include<bits/stdc++.h>

#define     ll      long long
#define     pb      push_back
#define     eps     1e-9
#define     ff      first
#define     ss      second
#define     pi      acos(-1)
#define     Fast_Read                    ios_base::sync_with_stdio(false); cin.tie(nullptr);  cout.tie(nullptr);
#define     Precision(x)                 cout.setf(ios::fixed); cout.precision(x);

using namespace std;
typedef long double ld;
#ifdef ARnAb
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " is " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cerr.write(names, comma - names) << " is " << arg1 <<"  ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************
int cs=0;
void solve()
{
    int n,t;
    cin>>n>>t;
    int prevtime=0,mntemp=t,mxtemp=t;
    for(int i=0;i<n;i++)
    {
        int time, l,r;
        cin>>time>>l>>r;
        int timedif=time-prevtime;
        if(l>mxtemp)
        {
            if(l-mxtemp>timedif)
            {
                cout<<"NO"<<endl;
                return;
            }
            else
            {
                mxtemp=min(mxtemp+timedif,r);
                mntemp=l;
            }
        }
        if(r<mntemp)
        {
            if(mntemp-r>timedif)
            {
                cout<<"NO"<<endl;
                return;
            }
            else
            {
                mntemp=max(mntemp-timedif,l);
                mxtemp=r;
            }
        }
        else
        {
            mntemp=max(mntemp-timedif,l);
            mxtemp=min(mxtemp+timedif,r);
        }
        prevtime=time;
    }
    cout<<"YES"<<endl;
}
int main()
{
    Fast_Read
    Precision(2)
    #ifdef ARnAb
        double start_time = clock();
        ///freopen ("output.txt","w",stdout);
        ///freopen ("input.txt","r",stdin);
    #endif
    int tc=1;
    cin>>tc;
    while(tc--)
        solve();
    return 0;
}


#include<bits/stdc++.h>

#define     ll      long long
#define     pb      push_back
#define     eps     1e-9
#define     ff      first
#define     ss      second
#define     pi      acos(-1)
#define     Fast_Read                    ios_base::sync_with_stdio(false); cin.tie(nullptr);  cout.tie(nullptr);
#define     Precision(x)                 cout.setf(ios::fixed); cout.precision(x);

using namespace std;
typedef long double ld;
#ifdef ARnAb
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " is " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cerr.write(names, comma - names) << " is " << arg1 <<"  ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************
int cs=0;
void solve()
{
    int n,t;
    cin>>n>>t;
    int prevtime=0,mntemp=t,mxtemp=t;
    for(int i=0;i<n;i++)
    {
        int time, l,r;
        cin>>time>>l>>r;
        int timedif=time-prevtime;
        if(l>mxtemp)
        {
            if(abs(l-mxtemp)>timedif)
            {
                cout<<"NO"<<endl;
                return;
            }
            else
            {
                mxtemp=min(mxtemp+timedif,r);
                mntemp=l;
            }
        }
        if(r<mntemp)
        {
            if(abs(mntemp-r)>timedif)
            {
                cout<<"NO"<<endl;
                return;
            }
            else
            {
                mntemp=max(mntemp-timedif,l);
                mxtemp=r;
            }
        }
        else
        {
            mntemp=max(mntemp-timedif,l);
            mxtemp=min(mxtemp+timedif,r);
        }
        prevtime=time;
    }
    cout<<"YES"<<endl;
}
int main()
{
    Fast_Read
    Precision(2)
    #ifdef ARnAb
        double start_time = clock();
        ///freopen ("output.txt","w",stdout);
        ///freopen ("input.txt","r",stdin);
    #endif
    int tc=1;
    cin>>tc;
    while(tc--)
        solve();
    return 0;
}


//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//* vamsicool007    You are never wrong to do the right thing    vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
bool isPrime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}

signed main()
{
    flash;
    #ifndef ONLINE_JUDGE
    freopen("infile.txt", "r", stdin);
    freopen("oufile.txt", "w", stdout);
	#endif
    int t=1;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        int maxx=m,minn=m;
        int l,h;
        int f=0;
        int t[n];
        for(int i=0;i<n;i++)
        {
        	//cout<<"1"<<endl;
        	cin>>t[i]>>l>>h;

        	if(i==0)
        	{
        		minn-=t[i];
        		maxx+=t[i];
        	}
        	else
        	{
        		minn-=(t[i]-t[i-1]);
        		maxx+=(t[i]-t[i-1]);
        	}

        	if(l>maxx || h<minn)
        	{
        		f=1;
        		break;
        	}
        	minn=max(minn,l);
        	maxx=min(maxx,h);
        }
        if(f)
        	cout<<"NO"<<endl;
        else
        	cout<<"YES"<<endl;
    }
    return 0;
}


//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//* vamsicool007    You are never wrong to do the right thing    vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
bool isPrime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}

signed main()
{
    flash;
    #ifndef ONLINE_JUDGE
    freopen("infile.txt", "r", stdin);
    freopen("oufile.txt", "w", stdout);
	#endif
    int t=1;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        int maxx=m;
        int minn=m;
        int t1=0;
        int f=0;
        for(int i=0;i<n;i++)
        {
        	int t,l,h;
        	cin>>t>>l>>h;
        	int val=t-t1;
        	t1=t;
        	minn-=val;
        	maxx+=val;
        	//cout<<maxx<<minn<<endl;
        	if(l>maxx || h<minn)
        		f=1;
        	minn=max(minn,l);
        	maxx=min(maxx,h);
        	//cout<<maxx<<minn<<endl;
        }
        if(f)
        	cout<<"NO"<<endl;
        else
        	cout<<"YES"<<endl;
    }
    return 0;
}


//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//* vamsicool007    You are never wrong to do the right thing    vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
bool isPrime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}

signed main()
{
    flash;
    #ifndef ONLINE_JUDGE
    freopen("infile.txt", "r", stdin);
    freopen("oufile.txt", "w", stdout);
	#endif
    int t=1;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        int maxx=m;
        int minn=m;
        int t1=0;
        int f=0;
        for(int i=0;i<n;i++)
        {
        	int t,l,h;
        	cin>>t>>l>>h;
        	int val=t-t1;
        	t1=t;
        	minn=minn-val;
        	maxx+=val;
        	//cout<<maxx<<minn<<endl;
        	if(l>maxx || h<minn)
        		{f=1;break;}
        	minn=max(minn,l);
        	maxx=min(maxx,h);
        	//cout<<maxx<<minn<<endl;
        }
        if(f)
        	cout<<"NO"<<endl;
        else
        	cout<<"YES"<<endl;
    }
    return 0;
}


//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//* vamsicool007    You are never wrong to do the right thing    vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
bool isPrime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}

signed main()
{
    flash;
    #ifndef ONLINE_JUDGE
    freopen("infile.txt", "r", stdin);
    freopen("oufile.txt", "w", stdout);
	#endif
    int t=1;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        int t[n+1];
        t[0]=0;
        int max1=m,min1=m;
        int f=0;
        for(int i=1;i<=n;i++)
        {
        	int h,l;
        	cin>>t[i]>>l>>h;
        	int d=t[i]-t[i-1];
        	if( (min1+d>=l && min1<=l) || (max1+d>=l && max1<=l) || (max1+d>=h && max1<=h) || (min1+d>=h && max1<=h) || (max1-d<=h && max1-d>=l && max1>=h) || (min1-d<=h && min1-d>=l && min1>=l))
        	{
        		min1=l;
        		max1=h;
        	}
        	else
        	{
        		f=1;
        		break;
        	}
        	//cout<<max1<<min1<<endl;
        }
        if(f)
        	cout<<"NO"<<endl;
        else
        	cout<<"YES"<<endl;
    }
    return 0;
}


//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//* vamsicool007    You are never wrong to do the right thing    vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
bool isPrime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}

signed main()
{
    flash;
    #ifndef ONLINE_JUDGE
    freopen("infile.txt", "r", stdin);
    freopen("oufile.txt", "w", stdout);
	#endif
    int t=1;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        int t[n+1];
        t[0]=0;
        int max1=m,min1=m;
        int f=0;
        for(int i=1;i<=n;i++)
        {
        	int h,l;
        	cin>>t[i]>>l>>h;
        	int d=t[i]-t[i-1];
        	if( (min1+d>=l && min1<=l) || (max1+d>=l && max1<=l) || (max1+d>=h && max1<=h) || (min1+d>=h && max1<=h) || (max1-d<=h && max1-d>=l && max1>=h) || (min1-d<=h && min1-d>=l && min1>=l))
        	{
        		min1=max(min1,l);
        		max1=min(max1,h);
        	}
        	else
        	{
        		f=1;
        		break;
        	}
        	//cout<<max1<<min1<<endl;
        }
        if(f)
        	cout<<"NO"<<endl;
        else
        	cout<<"YES"<<endl;
    }
    return 0;
}


//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//* vamsicool007    You are never wrong to do the right thing    vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
bool isPrime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}

signed main()
{
    flash;
    #ifndef ONLINE_JUDGE
    freopen("infile.txt", "r", stdin);
    freopen("oufile.txt", "w", stdout);
	#endif
    int t=1;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        int t[n+1];
        t[0]=0;
        int max1=m,min1=m;
        int f=0;
        for(int i=1;i<=n;i++)
        {
        	int h,l;
        	cin>>t[i]>>l>>h;
        	int d=t[i]-t[i-1];
        	if( (min1+d>=l && min1<=l) || (max1+d>=l && max1<=l) || (max1+d>=h && max1<=h) || (min1+d>=h && max1<=h) || (max1-d<=h && max1-d>=l) || (min1-d<=h && min1-d>=l))
        	{
        		min1=l;
        		max1=h;
        	}
        	else
        	{
        		f=1;
        		break;
        	}
        	//cout<<max1<<min1<<endl;
        }
        if(f)
        	cout<<"NO"<<endl;
        else
        	cout<<"YES"<<endl;
    }
    return 0;
}


//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//* vamsicool007    You are never wrong to do the right thing    vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
bool isPrime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}

signed main()
{
    flash;
    #ifndef ONLINE_JUDGE
    freopen("infile.txt", "r", stdin);
    freopen("oufile.txt", "w", stdout);
	#endif
    int t=1;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        int maxx=m,minn=m;
        int l,h;
        int f=0;
        int t=0;
        int t1[n];
        for(int i=0;i<n;i++)
        {
        	//cout<<"1"<<endl;
        	cin>>t1[i]>>l>>h;

        	int val=t1[i]-t;
        	t=t1[i];
        	minn-=val;
        	maxx+=val;

        	if(l>maxx || h<minn)
        	{
        		f=1;
        		break;
        	}
        	minn=max(minn,l);
        	maxx=min(maxx,h);
        }
        if(f)
        	cout<<"NO"<<endl;
        else
        	cout<<"YES"<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	 int t;cin>>t;
	while(t--){
		int n,m,count=0,c=0;cin>>n>>m; int a=m,b=m;int co=n;
		while(n--){
		int x,y,z;cin>>x>>y>>z;a=a-x+c;b=b+x-c;c=x;
			if(a>z || b<y){ break;}

			else{a=max(a,y);b=min(b,z);count++;}
		}
		if(count==co)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	 int t;cin>>t;
	while(t--){
		int n,m,count=1,c=0;cin>>n>>m; int a=m,b=m;
		while(n--){
		int x,y,z;cin>>x>>y>>z;a=a-x+c;b=b+x-c;c=x;
			if(a>z || b<y){ count=0;
				break;}

			else{a=max(a,y);b=min(b,z);}
		}
		if(count!=0)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long int t;
	cin>>t;
	while(t--)
	{
		long int m,n,t1=0,count=1;
		cin>>m>>n;
		long int n1=n,p=m;
		while(m--)
		{
			long int c,l,h;
			cin>>c>>l>>h;
			n=n-(c-t1);
			n1=n1+(c-t1);
			if(n>h || n1<l)
			{
			        t1=c;
                    count=0;
            }
			else
			{
			n=max(l,n);
			n1=min(h,n1);
			t1=c;
			}
		}

	if(count==1)
	cout<<"YES"<<endl;
	else
	cout<<"NO"<<endl;
	}
return 0;
	}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long int t;
	cin>>t;
	while(t--)
	{
		long int m,n,t1=0,count=0;
		cin>>m>>n;
		long int n1=n,p=m;
		while(m--)
		{
			long int c,l,h;
			cin>>c>>l>>h;
			if(n-(c-t1)>h || n1+(c-t1)<l)
			{
			        cout<<"NO"<<endl;
                    count--;
            }
			else
			{
			t1=c;
			n=l;
			n1=h;
			count++;
			}
		}

	if(count==p)
	cout<<"YES"<<endl;
	}
return 0;
	}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long int t;
	cin>>t;
	while(t--)
	{
		long int m,n,t1=0,count=0;
		cin>>m>>n;
		long int n1=n,p=m;
		while(m--)
		{
			long int c,l,h;
			cin>>c>>l>>h;
			if(n-(c-t1)>h || n1+(c-t1)<l)
			{
			        cout<<"NO"<<endl;
                    count++;
            }
			else
			{
			n=max(l,n-(c-t1));
			n1=min(h,n1+(c-t1));
			t1=c;
			}
		}

	if(count==0)
	cout<<"YES"<<endl;
	}
return 0;
	}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long int t;
	cin>>t;
	while(t--)
	{
		long int m,n,t1=0,count=0;
		cin>>m>>n;
		long int n1=n,p=m;
		while(m--)
		{
			long int c,l,h;
			cin>>c>>l>>h;
			n=n-(c-t1);
			n1=n1+(c-t1);
			if(n>h || n1<l)
			{
			        cout<<"NO"<<endl;
			        t1=c;
                    count++;
            }
			else
			{
			n=max(l,n);
			n1=min(h,n1);
			t1=c;
			}
		}

	if(count==0)
	cout<<"YES"<<endl;
	}
return 0;
	}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long int t;
	cin>>t;
	while(t--)
	{
		long int m,n,t1=0,count=0;
		cin>>m>>n;
		long int n1=n,p=m;
		while(m--)
		{
			long int c,l,h;
			cin>>c>>l>>h;
			if(n-(c-t1)>h || n1+(c-t1)<l)
			{
			        cout<<"NO"<<endl;
			        t1=c;
                    count++;
            }
			else
			{
			n=max(l,n-(c-t1));
			n1=min(h,n1+(c-t1));
			t1=c;
			}
		}

	if(count==0)
	cout<<"YES"<<endl;
	}
return 0;
	}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long int t;
	cin>>t;
	while(t--)
	{
		long int m,n,t1=0,count=0;
		cin>>m>>n;
		long int n1=n,p=m;
		while(m--)
		{
			long int c,l,h;
			cin>>c>>l>>h;
			if(n-(c-t1)>h || n1+(c-t1)<l)
			{
			        cout<<"NO"<<endl;
                                break;
                        }
			else
			{
			t1=c;
			n=l;
			n1=h;
			count++;
			}
		}

	if(count==p)
	cout<<"YES"<<endl;
	}
return 0;
	}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long int t;
	cin>>t;
	while(t--)
	{
		long int m,n,t1=0,count=0;
		cin>>m>>n;
		long int n1=n,p=m;
		while(m--)
		{
			long int c,l,h;
			cin>>c>>l>>h;
			if(n-(c-t1)>h || n1+(c-t1)<l)
			{
			        cout<<"NO"<<endl;
                    count++;
            }
			else
			{
			t1=c;
			n=l;
			n1=h;
			}
		}

	if(count==0)
	cout<<"YES"<<endl;
	}
return 0;
	}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long int t;
	cin>>t;
	while(t--)
	{
		long int m,n,t1=0,count=0;
		cin>>m>>n;
		long int n1=n,p=m;
		while(m--)
		{
			long int c,l,h;
			cin>>c>>l>>h;
			n=n-(c-t1);
			n1=n1+(c-t1);
			if(n>h || n1<l)
			{
			        t1=c;
                    count++;
            }
			else
			{
			n=max(l,n);
			n1=min(h,n1);
			t1=c;
			}
		}

	if(count==0)
	cout<<"YES"<<endl;
	else
	cout<<"NO"<<endl;
	}
return 0;
	}


  #include <bits/stdc++.h>
  using namespace std;
  #define F first
  #define S second
  #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
  #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
  #define all(x) (x).begin(), (x).end()
  #define sz(x) int(x.size())
  #define mp(i,a) make_pair(i,a)
  #define pb(a) push_back(a)
  #define bit(x,b) (x&(1LL<<b))

  typedef long long int lli;
  typedef pair <int,int> ii;
  typedef vector <int> vi;
  lli mod=998244353;
  int main()
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int test;
    cin>>test;
    for(;test>0;--test)
    {
      int n,m;
      cin>>n>>m;
      pair<ii,int> arr[n+1];
      arr[0]=mp(mp(0,m),m);
      for(int i=1;i<=n;++i)
        cin>>arr[i].F.F>>arr[i].F.S>>arr[i].S;
      sort(arr,arr+n);
      int t=0,r=m,l=m,c=0,it=0;
      for(int i=1;i<=n;++i)
      {
        if(m<arr[i].F.S||m>arr[i].S)
        {
          t+=min(abs(m-arr[i].F.S),abs(m-arr[i].S));
          m=(min(abs(m-arr[i].F.S),abs(m-arr[i].S))==abs(m-arr[i].F.S))?arr[i].F.S:arr[i].S;
        }
        int r=arr[i].S,l=arr[i].F.S;
        it=arr[i].F.F;
        if(t>it)
        {
          c=1;
          break;
        }
        if(i!=n)
        {
          if(!(arr[i+1].F.S>arr[i].S&&arr[i+1].S<arr[i].F.S))
          {
            r=min(r,arr[i+1].S);
            l=max(l,arr[i+1].F.S);
            if(m<l)
            {
              m=m+min(it,t+l-m)-t;
              t=min(it,t+l-m);
            }
            else if(m>r)
            {
             m=m-min(it,t+m-r)+t;
              t=min(it,t+m-r);
            }
          }
          else
          {
            if(arr[i+1].F.S<l)
            {
             m=m-min(it,t+m-l)+t;
              t=min(it,t+m-l);
            }
            else
            {
              m=m-min(it,t+r-m)+t;
              t=min(it,t+r-m);
            }
            t=it;
          }
        }
      }
      if(c==1)
        cout<<"NO"<<endl;
      else
        cout<<"YES"<<endl;
    }
    return(0);
  }


  #include <bits/stdc++.h>
  using namespace std;
  #define F first
  #define S second
  #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
  #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
  #define all(x) (x).begin(), (x).end()
  #define sz(x) int(x.size())
  #define mp(i,a) make_pair(i,a)
  #define pb(a) push_back(a)
  #define bit(x,b) (x&(1LL<<b))

  typedef long long int lli;
  typedef pair <int,int> ii;
  typedef vector <int> vi;
  lli mod=998244353;
  int main()
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int test;
    cin>>test;
    for(;test>0;--test)
    {
      int n,m;
      cin>>n>>m;
      pair<ii,int> arr[n+1];
      arr[0]=mp(mp(0,m),m);
      for(int i=1;i<=n;++i)
        cin>>arr[i].F.F>>arr[i].F.S>>arr[i].S;
      sort(arr,arr+n);
      int t=0,r=m,l=m,c=0,it=0;
      for(int i=1;i<=n;++i)
      {
        if(l-(arr[i].F.F-arr[i-1].F.F)>arr[i].S||r-arr[i-1].F.F+arr[i].F.F<arr[i].F.S)
        {
          c=1;
          break;
        }
        else
        {
          l=max(l-(arr[i].F.F-arr[i-1].F.F),arr[i].F.S);
          r=min(r-arr[i-1].F.F+arr[i].F.F,arr[i].S);
        }
      }
      if(c==1)
        cout<<"NO"<<endl;
      else
        cout<<"YES"<<endl;
    }
    return(0);
  }


  #include <bits/stdc++.h>
  using namespace std;
  #define F first
  #define S second
  #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
  #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
  #define all(x) (x).begin(), (x).end()
  #define sz(x) int(x.size())
  #define mp(i,a) make_pair(i,a)
  #define pb(a) push_back(a)
  #define bit(x,b) (x&(1LL<<b))

  typedef long long int lli;
  typedef pair <int,int> ii;
  typedef vector <int> vi;
  lli mod=998244353;
  int main()
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int test;
    cin>>test;
    for(;test>0;--test)
    {
      int n,m;
      cin>>n>>m;
      pair<ii,int> arr[n+1];
      arr[0]=mp(mp(0,m),m);
      for(int i=1;i<=n;++i)
        cin>>arr[i].F.F>>arr[i].F.S>>arr[i].S;
      sort(arr,arr+n);
      int t=0,r=m,l=m,c=0,it=0;
      for(int i=1;i<=n;++i)
      {
        if(l-(arr[i].F.F-arr[i-1].F.F)>arr[i].S||r-arr[i-1].F.F+arr[i].F.F<arr[i].F.S)
        {
          c=1;
          break;
        }
        else
        {
          l=max(l-(arr[i].F.F-arr[i-1].F.F),arr[i].S);
          r=min(r-arr[i-1].F.F+arr[i].F.F,arr[i].F.S);
        }
      }
      if(c==1)
        cout<<"NO"<<endl;
      else
        cout<<"YES"<<endl;
    }
    return(0);
  }


  #include <bits/stdc++.h>
  using namespace std;
  #define F first
  #define S second
  #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
  #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
  #define all(x) (x).begin(), (x).end()
  #define sz(x) int(x.size())
  #define mp(i,a) make_pair(i,a)
  #define pb(a) push_back(a)
  #define bit(x,b) (x&(1LL<<b))

  typedef long long int lli;
  typedef pair <int,int> ii;
  typedef vector <int> vi;
  lli mod=998244353;
  int main()
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int test;
    cin>>test;
    for(;test>0;--test)
    {
      int n,m;
      cin>>n>>m;
      pair<ii,int> arr[n+1];
      arr[0]=mp(mp(0,m),m);
      for(int i=1;i<=n;++i)
        cin>>arr[i].F.F>>arr[i].F.S>>arr[i].S;
      sort(arr,arr+n);
      int t=0,r=m,l=m,c=0,it=0;
      for(int i=1;i<=n;++i)
      {
        if(m<arr[i].F.S||m>arr[i].S)
        {
          t+=min(abs(m-arr[i].F.S),abs(m-arr[i].S));
          m=(min(abs(m-arr[i].F.S),abs(m-arr[i].S))==abs(m-arr[i].F.S))?arr[i].F.S:arr[i].S;
        }
        it=arr[i].F.F;
        r=arr[i].S;
        l=arr[i].F.S;
        if(t>it)
        {
          c=1;
          break;
        }
        int iit=i;
        i++;
        while(t!=it&&i!=n+1)
        {
          if(!(arr[i].F.S>r||arr[i].S<l))
          {
            l=max(arr[i].F.S,l);
            r=min(arr[i].S,r);
            if(m>=l&&m<=r)
              i++;
            else if(m>r)
            {
              m=m-min(it,t+m-r)+t;
              t=min(it,t+m-r);
              i++;
            }
            else
            {
             m=m+min(it,t+l-m)-t;
              t=min(it,t+l-m);
              i++;
            }
          }
          else
          {
            if(m>arr[i].S)
            {
              m=m-min(it,m-l+t)+t;
              t=min(it,m-l+t);
            }
            else
            {
             m=m+min(it,r-m+t)-t;
              t=min(it,r-m+t);
            }
            t=it;
          }
          if(t==it)
          {
            i=iit;
            break;
          }
        }
        i=iit;
        t=it;
      }
      if(c==1)
        cout<<"NO"<<endl;
      else
        cout<<"YES"<<endl;
    }
    return(0);
  }


  #include <bits/stdc++.h>
  using namespace std;
  #define F first
  #define S second
  #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
  #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
  #define all(x) (x).begin(), (x).end()
  #define sz(x) int(x.size())
  #define mp(i,a) make_pair(i,a)
  #define pb(a) push_back(a)
  #define bit(x,b) (x&(1LL<<b))

  typedef long long int lli;
  typedef pair <int,int> ii;
  typedef vector <int> vi;
  lli mod=998244353;
  int main()
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int test;
    cin>>test;
    for(;test>0;--test)
    {
      int n,m;
      cin>>n>>m;
      pair<ii,int> arr[n+1];
      arr[0]=mp(mp(0,m),m);
      for(int i=1;i<=n;++i)
        cin>>arr[i].F.F>>arr[i].F.S>>arr[i].S;
      sort(arr,arr+n);
      int t=0,r=m,l=m,c=0,it=0;
      for(int i=1;i<=n;++i)
      {
        if(m<arr[i].F.S||m>arr[i].S)
        {
          t+=min(abs(m-arr[i].F.S),abs(m-arr[i].S));
          m=(min(abs(m-arr[i].F.S),abs(m-arr[i].S))==abs(m-arr[i].F.S))?arr[i].F.S:arr[i].S;
        }
        it=arr[i].F.F;
        r=arr[i].S;
        l=arr[i].F.S;
        if(t>it)
        {
          c=1;
          break;
        }
        int iit=i;
        i++;
        while(t!=it||i!=n+2)
        {
          if(!(arr[i].F.S>r||arr[i].S<l))
          {
            l=max(arr[i].F.S,l);
            r=min(arr[i].S,r);
            if(m>=l&&m<=r)
              i++;
            else if(m>r)
            {
              m=m-min(it,t+m-r)+t;
              t=min(it,t+m-r);
              i++;
            }
            else
            {
             m=m+min(it,t+l-m)-t;
              t=min(it,t+l-m);
              i++;
            }
          }
          else
          {
            if(m>arr[i].S)
            {
              m=m-min(it,m-l+t)+t;
              t=min(it,m-l+t);
            }
            else
            {
             m=m+min(it,r-m+t)-t;
              t=min(it,r-m+t);
            }
            t=it;
          }
          if(t==it)
          {
            i=iit;
            break;
          }
        }
      }
      if(c==1)
        cout<<"NO"<<endl;
      else
        cout<<"YES"<<endl;
    }
    return(0);
  }


  #include <bits/stdc++.h>
  using namespace std;
  #define F first
  #define S second
  #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
  #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
  #define all(x) (x).begin(), (x).end()
  #define sz(x) int(x.size())
  #define mp(i,a) make_pair(i,a)
  #define pb(a) push_back(a)
  #define bit(x,b) (x&(1LL<<b))

  typedef long long int lli;
  typedef pair <int,int> ii;
  typedef vector <int> vi;
  lli mod=998244353;
  int main()
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int test;
    cin>>test;
    for(;test>0;--test)
    {
      int n,m;
      cin>>n>>m;
      pair<ii,int> arr[n+1];
      arr[0]=mp(mp(0,m),m);
      for(int i=1;i<=n;++i)
        cin>>arr[i].F.F>>arr[i].F.S>>arr[i].S;
      sort(arr,arr+n);
      int t=0,r=m,l=m,c=0,it=0;
      for(int i=1;i<=n;++i)
      {
        if(m<arr[i].F.S||m>arr[i].S)
        {
          t+=min(abs(m-arr[i].F.S),abs(m-arr[i].S));
          m=(min(abs(m-arr[i].F.S),abs(m-arr[i].S))==abs(m-arr[i].F.S))?arr[i].F.S:arr[i].S;
        }
        it=arr[i].F.F;
        r=arr[i].S;
        l=arr[i].F.S;
        if(t>it)
        {
          c=1;
          break;
        }
        int iit=i;
        i++;
        while(t!=it&&i!=n+1)
        {
          if(!(arr[i].F.S>r||arr[i].S<l))
          {
            l=max(arr[i].F.S,l);
            r=min(arr[i].S,r);
            if(m>=l&&m<=r)
              i++;
            else if(m>r)
            {
              m=m-min(it,t+m-r)+t;
              t=min(it,t+m-r);
              i++;
            }
            else
            {
             m=m+min(it,t+l-m)-t;
              t=min(it,t+l-m);
              i++;
            }
          }
          else
          {
            if(m>arr[i].S)
            {
              m=m-min(it,m-l+t)+t;
              t=min(it,m-l+t);
            }
            else
            {
             m=m+min(it,r-m+t)-t;
              t=min(it,r-m+t);
            }
            t=it;
          }
          if(t==it)
          {
            i=iit;
            break;
          }
        }
      }
      if(c==1)
        cout<<"NO"<<endl;
      else
        cout<<"YES"<<endl;
    }
    return(0);
  }


  #include <bits/stdc++.h>
  using namespace std;
  #define F first
  #define S second
  #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
  #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
  #define all(x) (x).begin(), (x).end()
  #define sz(x) int(x.size())
  #define mp(i,a) make_pair(i,a)
  #define pb(a) push_back(a)
  #define bit(x,b) (x&(1LL<<b))

  typedef long long int lli;
  typedef pair <int,int> ii;
  typedef vector <int> vi;
  lli mod=998244353;
  int main()
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int test;
    cin>>test;
    for(;test>0;--test)
    {
      int n,m;
      cin>>n>>m;
      pair<ii,int> arr[n+1];
      arr[0]=mp(mp(0,m),m);
      for(int i=1;i<=n;++i)
        cin>>arr[i].F.F>>arr[i].F.S>>arr[i].S;
      sort(arr,arr+n);
      int t=0,r=m,l=m,c=0,it=0;
      for(int i=1;i<=n;++i)
      {
        if(m<arr[i].F.S||m>arr[i].S)
        {
          t+=min(abs(m-arr[i].F.S),abs(m-arr[i].S));
          m=(min(abs(m-arr[i].F.S),abs(m-arr[i].S))==abs(m-arr[i].F.S))?arr[i].F.S:arr[i].S;
        }
        it=arr[i].F.F;
        r=arr[i].S;
        l=arr[i].F.S;
        if(t>it)
        {
          c=1;
          break;
        }
        int iit=i;
        i++;
        while(t!=it||i!=n+1)
        {
          if(!(arr[i].F.S>r||arr[i].S<l))
          {
            l=max(arr[i].F.S,l);
            r=min(arr[i].S,r);
            if(m>=l&&m<=r)
              i++;
            else if(m>r)
            {
              m=m-min(it,t+m-r)+t;
              t=min(it,t+m-r);
              i++;
            }
            else
            {
             m=m+min(it,t+l-m)-t;
              t=min(it,t+l-m);
              i++;
            }
          }
          else
          {
            if(m>arr[i].S)
            {
              m=m-min(it,m-l+t)+t;
              t=min(it,m-l+t);
            }
            else
            {
             m=m+min(it,r-m+t)-t;
              t=min(it,r-m+t);
            }
            t=it;
          }
          if(t==it)
          {
            i=iit;
            break;
          }
        }
      }
      if(c==1)
        cout<<"NO"<<endl;
      else
        cout<<"YES"<<endl;
    }
    return(0);
  }


  #include <bits/stdc++.h>
  using namespace std;
  #define F first
  #define S second
  #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
  #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
  #define all(x) (x).begin(), (x).end()
  #define sz(x) int(x.size())
  #define mp(i,a) make_pair(i,a)
  #define pb(a) push_back(a)
  #define bit(x,b) (x&(1LL<<b))

  typedef long long int lli;
  typedef pair <int,int> ii;
  typedef vector <int> vi;
  lli mod=998244353;
  int main()
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int test;
    cin>>test;
    for(;test>0;--test)
    {
      int n,m;
      cin>>n>>m;
      pair<ii,int> arr[n+1];
      arr[0]=mp(mp(0,m),m);
      for(int i=1;i<=n;++i)
        cin>>arr[i].F.F>>arr[i].F.S>>arr[i].S;
      sort(arr,arr+n);
      int t=0,r=m,l=m,c=0,it=0;
      for(int i=1;i<=n;++i)
      {
        if(m<arr[i].F.S||m>arr[i].S)
        {
          t+=min(abs(m-arr[i].F.S),abs(m-arr[i].S));
          m=(min(abs(m-arr[i].F.S),abs(m-arr[i].S))==abs(m-arr[i].F.S))?arr[i].F.S:arr[i].S;
        }
        it=arr[i].F.F;
        r=arr[i].S;
        l=arr[i].F.S;
        if(t>it)
        {
          c=1;
          break;
        }
        int iit=i;
        i++;
        while(t!=it)
        {
          if(!(arr[i].F.S>r||arr[i].S<l))
          {
            l=max(arr[i].F.S,l);
            r=min(arr[i].S,r);
            if(m>=l&&m<=r)
              i++;
            else if(m>r)
            {
              m=m-min(it,t+m-r)+t;
              t=min(it,t+m-r);
              i++;
            }
            else
            {
             m=m+min(it,t+l-m)-t;
              t=min(it,t+l-m);
              i++;
            }
          }
          else
          {
            if(m>arr[i].S)
            {
              m=m-min(it,m-l+t)+t;
              t=min(it,m-l+t);
            }
            else
            {
             m=m+min(it,r-m+t)-t;
              t=min(it,r-m+t);
            }
            t=it;
          }
          if(t==it)
          {
            i=iit;
            break;
          }
        }
      }
      if(c==1)
        cout<<"NO"<<endl;
      else
        cout<<"YES"<<endl;
    }
    return(0);
  }


#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    int q;
    cin >> q;
    while(q--){
        int n, tmp;
        cin >> n >> tmp;
        int bef = 0;
        ll low = tmp, high = tmp;
        int i;
        for(i = 0; i < n; i++){
            int t;
            ll l, h;
            cin >> t >> l >> h;
            int x = t-bef;
            low -= x, high += x;
            low = max(low, l);
            high = min(high, h);
            if(high < low){
                break;
            }
            bef = t;
        }
        cout << (i==n ? "YES" : "NO") << endl;
    }
}


#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    int q;
    cin >> q;
    while(q--){
        ll n, tmp;
        cin >> n >> tmp;
        ll bef = 0, low = tmp, high = tmp;
        bool ng = false;
        for(int i = 0; i < n; i++){
            ll t, l, h;
            cin >> t >> l >> h;
            if(ng)  continue;
            ll x = t-bef;
            low -= x, high += x;
            low = max(low, l);
            high = min(high, h);
            if(high < low){
                ng = true;
            }
            bef = t;
        }
        cout << (!ng ? "YES" : "NO") << endl;
    }
}


#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    int q;
    cin >> q;
    while(q--){
        int n, tmp;
        cin >> n >> tmp;
        int bef = 0;
        ll low = tmp, high = tmp;
        int i;
        bool flag = false;
        for(i = 0; i < n; i++){
            int t;
            ll l, h;
            cin >> t >> l >> h;
            int x = t-bef;
            low -= x, high += x;
            low = max(low, l);
            high = min(high, h);
            if(high < low){
                flag = true;
                break;
            }
            bef = t;
        }
        cout << (!flag ? "YES" : "NO") << endl;
    }
}


#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    int q;
    cin >> q;
    while(q--){
        ll n, tmp;
        cin >> n >> tmp;
        ll bef = 0, low = tmp, high = tmp;
        int i;
        for(i = 0; i < n; i++){
            ll t, l, h;
            cin >> t >> l >> h;
            ll x = t-bef;
            low -= x, high += x;
            low = max(low, l);
            high = min(high, h);
            if(high < low){
                break;
            }
            bef = t;
        }
        cout << (i==n ? "YES" : "NO") << endl;
    }
}


#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    int q;
    cin >> q;
    while(q--){
        int n, tmp;
        cin >> n >> tmp;
        int bef = 0;
        ll low = tmp, high = tmp;
        int i;
        for(i = 0; i < n; i++){
            int t;
            ll l, h;
            cin >> t >> l >> h;
            int x = t-bef;
            low -= x, high += x;
            low = max(low, l);
            high = min(high, h);
            if(high < low){
                break;
            }
            bef = t;
        }
        cout << (low <= high ? "YES" : "NO") << endl;
    }
}


#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    int q;
    cin >> q;
    while(q--){
        int n, tmp;
        cin >> n >> tmp;
        int bef = 0;
        ll low = tmp, high = tmp;
        int i;
        for(i = 0; i < n; i++){
            int t;
            ll l, h;
            cin >> t >> l >> h;
            int x = t-bef;
            low -= x, high += x;
            if(high < l || h < low){
                break;
            }
            low = max(low, l);
            high = min(high, h);
            bef = t;
        }
        cout << (i==n ? "YES" : "NO") << endl;
    }
}


#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <set>
#include <string>
using namespace std;
struct MyHash {
    int operator() (const vector<int> &v) const {
        std::size_t ret = 0;
        for(auto& i : v) {
            ret ^= std::hash<uint32_t>()(i);
        }
        return ret;
    }
};
#define int long long
pair < int, int > p[211111];
int x, y, n, m, q;
string f, mid, se;
main(){
    cin >> q;
    while(q--){
        cin >> n >> m;
        x = 0;
        y = 0;
        int ml = m, mr = m;
        for(int i = 1; i <= n; i++){
            int t, l, r;
            cin >> t >> l >> r;
            int rng = t - y;
            ml = ml - rng, mr = mr + rng;
            if(ml > r || mr < l){
                x = 1;
                break;
            }
            ml = max(ml, l);
            mr = min(mr, r);
            y = t;
        }
        if(x == 1){
            cout << "NO";
        }else{
            cout << "YES";
        }
        cout << endl;
    }
}


#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <set>
#include <string>
using namespace std;
struct MyHash {
    int operator() (const vector<int> &v) const {
        std::size_t ret = 0;
        for(auto& i : v) {
            ret ^= std::hash<uint32_t>()(i);
        }
        return ret;
    }
};
pair < int, int > p[211111];
int x, y, n, m, q;
string f, mid, se;
int main(){
    cin >> q;
    while(q--){
        cin >> n >> m;
        x = 0;
        y = 0;
        int ml = m, mr = m;
        for(int i = 1; i <= n; i++){
            int t, l, r;
            cin >> t >> l >> r;
            ml = ml - (t - y), mr = mr + (t - y);
            if(ml > r || mr < l){
                x = 1;
                break;
            }
            ml = max(ml, l);
            mr = min(mr, r);
            y = t;
        }
        if(x == 1){
            cout << "NO";
        }else{
            cout << "YES";
        }
        cout << endl;
    }
}


#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <set>
#include <string>
using namespace std;
struct MyHash {
    int operator() (const vector<int> &v) const {
        std::size_t ret = 0;
        for(auto& i : v) {
            ret ^= std::hash<uint32_t>()(i);
        }
        return ret;
    }
};
pair < int, int > p[211111];
int x, y, n, m, q;
string f, mid, se;
int main(){
    cin >> q;
    while(q--){
        cin >> n >> m;
        x = 0;
        y = 0;
        int ml = m, mr = m;
        for(int i = 1; i <= n; i++){
            int t, l, r;
            cin >> t >> l >> r;
            int rng = t - y;
            ml = max(ml - rng, l), mr = min(mr + rng, r);
            if(ml > r || mr < l){
                x = 1;
                break;
            }
            y = t;
        }
        if(x == 1){
            cout << "NO";
        }else{
            cout << "YES";
        }
        cout << endl;
    }
}


#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <set>
#include <string>
using namespace std;
struct MyHash {
    int operator() (const vector<int> &v) const {
        std::size_t ret = 0;
        for(auto& i : v) {
            ret ^= std::hash<uint32_t>()(i);
        }
        return ret;
    }
};
pair < int, int > p[211111];
int x, y, n, m, q;
string f, mid, se;
int main(){
    cin >> q;
    while(q--){
        cin >> n >> m;
        x = 0;
        y = 0;
        int ml = m, mr = m;
        int l[n + 1], r[n+ 1], t[n + 1];
        for(int i = 1; i <= n; i++) {
            cin >> t[i] >> l[i] >> r[i];
        }
        for(int i = 1; i <= n; i++) {
            ml = ml - (t[i] - y), mr = mr + (t[i] - y);
            if(ml > r[i] || mr < l[i]){
                x = 1;
                break;
            }
            ml = max(ml, l[i]);
            mr = min(mr, r[i]);
            y = t[i];
        }
        if(x == 1){
            cout << "NO";
        }else{
            cout << "YES";
        }
        cout << endl;
    }
}


#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <set>
#include <string>
using namespace std;
struct MyHash {
    int operator() (const vector<int> &v) const {
        std::size_t ret = 0;
        for(auto& i : v) {
            ret ^= std::hash<uint32_t>()(i);
        }
        return ret;
    }
};
pair < int, int > p[211111];
int x, y, n, m, q;
string f, mid, se;
int main(){
    cin >> q;
    while(q--){
        cin >> n >> m;
        int ml = m, mr = m;
        for(int i = 1; i <= n; i++){
            int t, l, r;
            x = 0;
            cin >> t >> l >> r;
            int rng = t - m + 1;
            if(abs(ml - l) <= rng || abs(ml - r) <= rng || abs(mr - l) <= rng || abs(mr - r) <= rng){
                ml = max(ml - rng, l), mr = min(mr + rng, r);
            }else{
                x = 1;
            }
        }
        if(x == 1){
            cout << "NO";
        }else{
            cout << "YES";
        }
        cout << endl;
    }
}


#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <set>
#include <string>
using namespace std;
struct MyHash {
    int operator() (const vector<int> &v) const {
        std::size_t ret = 0;
        for(auto& i : v) {
            ret ^= std::hash<uint32_t>()(i);
        }
        return ret;
    }
};
#define int long long
pair < int, int > p[211111];
int x, y, n, m, q;
string f, mid, se;
main(){
    cin >> q;
    while(q--){
        cin >> n >> m;
        x = 0;
        y = 0;
        int ml = m, mr = m;
        for(int i = 1; i <= n; i++){
            int t, l, r;
            cin >> t >> l >> r;
            int rng = t - y;
            ml = max(ml - rng, l), mr = min(mr + rng, r);
            if(ml > r || mr < l){
                x = 1;
                break;
            }
            y = t;
        }
        if(x == 1){
            cout << "NO";
        }else{
            cout << "YES";
        }
        cout << endl;
    }
}


#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <set>
#include <string>
using namespace std;
struct MyHash {
    int operator() (const vector<int> &v) const {
        std::size_t ret = 0;
        for(auto& i : v) {
            ret ^= std::hash<uint32_t>()(i);
        }
        return ret;
    }
};
#define int long long
pair < int, int > p[211111];
int x, y, n, m, q;
string f, mid, se;
main(){
    cin >> q;
    while(q--){
        cin >> n >> m;
        x = 0;
        y = 0;
        int ml = m, mr = m;
        for(int i = 1; i <= n; i++){
            int t, l, r;
            cin >> t >> l >> r;
            int rng = t - y + 1;
            if(i == 1){
              rng--;
            }
            ml = max(ml - rng, l), mr = min(mr + rng, r);
            if(ml > r || mr < l){
                x = 1;
                break;
            }
            y = t + 1;
        }
        if(x == 1){
            cout << "NO";
        }else{
            cout << "YES";
        }
        cout << endl;
    }
}


#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <set>
#include <string>
using namespace std;
struct MyHash {
    int operator() (const vector<int> &v) const {
        std::size_t ret = 0;
        for(auto& i : v) {
            ret ^= std::hash<uint32_t>()(i);
        }
        return ret;
    }
};
pair < int, int > p[211111];
int x, y, n, m, q;
string f, mid, se;
int main(){
    cin >> q;
    while(q--){
        cin >> n >> m;
        int ml = m, mr = m;
        for(int i = 1; i <= n; i++){
            int t, l, r;
            x = 0;
            cin >> t >> l >> r;
            int rng = t - m;
            if(abs(ml - l) <= rng || abs(ml - r) <= rng || abs(mr - l) <= rng || abs(mr - r) <= rng){
                ml = max(ml - rng, l), mr = min(mr + rng, r);
            }else{
                x = 1;
            }
            m = t;
        }
        if(x == 1){
            cout << "NO";
        }else{
            cout << "YES";
        }
        cout << endl;
    }
}


#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <set>
#include <string>
using namespace std;
struct MyHash {
    int operator() (const vector<int> &v) const {
        std::size_t ret = 0;
        for(auto& i : v) {
            ret ^= std::hash<uint32_t>()(i);
        }
        return ret;
    }
};
pair < int, int > p[211111];
int x, y, n, m, q;
string f, mid, se;
int main(){
    cin >> q;
    while(q--){
        cin >> n >> m;
        int ml = m, mr = m;
        for(int i = 1; i <= n; i++){
            int t, l, r;
            cin >> t >> l >> r;
            int rng = t - m + 1;
            if(abs(ml - l) <= rng || abs(ml - r) <= rng || abs(mr - l) <= rng || abs(mr - r) <= rng){
                ml = max(ml - rng, l), mr = min(mr + rng, r);
            }else{
                x = 1;
                break;
            }
        }
        if(x == 1){
            cout << "NO";
        }else{
            cout << "YES";
        }
        cout << endl;
    }
}


#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <set>
#include <string>
using namespace std;
struct MyHash {
    int operator() (const vector<int> &v) const {
        std::size_t ret = 0;
        for(auto& i : v) {
            ret ^= std::hash<uint32_t>()(i);
        }
        return ret;
    }
};
pair < int, int > p[211111];
int x, y, n, m, q;
string f, mid, se;
int main(){
    cin >> q;
    while(q--){
        cin >> n >> m;
        int ml = m, mr = m;
        for(int i = 1; i <= n; i++){
            int t, l, r;
            x = 0;
            cin >> t >> l >> r;
            int rng = t - m;
            if(abs(ml - l) <= rng || abs(ml - r) <= rng || abs(mr - l) <= rng || abs(mr - r) <= rng){
                ml = max(ml - rng, l), mr = min(mr + rng, r);
            }else{
                x = 1;
            }
        }
        if(x == 1){
            cout << "NO";
        }else{
            cout << "YES";
        }
        cout << endl;
    }
}


#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define db double
#define endl "\n"
#define fi first
#define se second
#define pii pair<int,int>
#define fo(a,b,c) for(int a = b;a <= c;a++)
#define mem(a,b) memset(a,b,sizeof a);
const int inf = 0x3f3f3f3f;
const int maxn = 1e2 + 30;
const int mod = 1e9 + 7;
struct node{
	int ti , d , u;
	friend bool operator < (node a, node b){
		if(a.ti == b.ti && a.d == b.d)return a.u < b.u;
		if(a.ti == b.ti)return a.d > b.d;
		return a.ti < b .ti;

	}
};
node a[maxn];
int main(){
	int t , n , m;cin >> t;
	while(t--){
		scanf("%d%d",&n,&m);
		bool ok = 1;
		fo(i,1,n){
			scanf("%d%d%d",&a[i].ti,&a[i].d,&a[i].u);
		}
		int cnt = 0 , m1 = m;
		fo(i,1,n){
			m1 = max(m1 - (a[i].ti - cnt) , a[i].d);
			m = min(m + (a[i].ti - cnt) , a[i].u);
			cnt = a[i].ti;
			if(m1 > a[i].u || m < a[i].d)ok = 0;
		}
		if(ok)cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}


#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define db double
#define endl "\n"
#define fi first
#define se second
#define pii pair<int,int>
#define fo(a,b,c) for(int a = b;a <= c;a++)
#define mem(a,b) memset(a,b,sizeof a);
const int inf = 0x3f3f3f3f;
const int maxn = 1e2 + 30;
const int mod = 1e9 + 7;
struct node{
	int ti , d , u;
	friend bool operator < (node a, node b){
		if(a.ti == b.ti && a.d == b.d)return a.u < b.u;
		if(a.ti == b.ti)return a.d > b.d;
		return a.ti < b .ti;

	}
};
node a[maxn];
int main(){
	int t , n , m;cin >> t;
	while(t--){
		scanf("%d%d",&n,&m);
		bool ok = 1;
		fo(i,1,n){
			scanf("%d%d%d",&a[i].ti,&a[i].d,&a[i].u);
		}
		int cnt = 0 , m1 = m;
		fo(i,1,n){
			if(m1 > a[i].d){
				if(a[i].ti - cnt >= m1 - a[i].d)m1 = a[i].d;
				else m1 -= (a[i].ti - cnt);
			}
			if(m1 < a[i].d){
				if(a[i].ti - cnt >= a[i].d - m1)m1 = a[i].d;
				else m1 += (a[i].ti - cnt);
			}
			if(m > a[i].u){
				if(a[i].ti - cnt >= m - a[i].u)m = a[i].u;
				else m -= (a[i].ti - cnt);
			}
			if(m < a[i].u){
				if(a[i].ti - cnt >= a[i].u - m)m = a[i].u;
				else m += (a[i].ti - cnt);
			}
			cnt = a[i].ti;
			if(m1 > a[i].u || m < a[i].d)ok = 0;
		}
		if(ok)cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}


#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define db double
#define endl "\n"
#define fi first
#define se second
#define pii pair<int,int>
#define fo(a,b,c) for(int a = b;a <= c;a++)
#define mem(a,b) memset(a,b,sizeof a);
const int inf = 0x3f3f3f3f;
const int maxn = 1e2 + 30;
const int mod = 1e9 + 7;
struct node{
	int ti , d , u;
	friend bool operator < (node a, node b){
		if(a.ti == b.ti && a.d == b.d)return a.u < b.u;
		if(a.ti == b.ti)return a.d > b.d;
		return a.ti < b .ti;

	}
};
node a[maxn];
int main(){
	int t , n , m;cin >> t;
	while(t--){
		scanf("%d%d",&n,&m);
		bool ok = 1;
		fo(i,1,n){
			scanf("%d%d%d",&a[i].ti,&a[i].d,&a[i].u);
		}
		int cnt = 0 , m1 = m;
		fo(i,1,n){
			if(m1 > a[i].d){
				if(a[i].ti - cnt >= m1 - a[i].d)m1 = a[i].d;
				else m1 -= (a[i].ti - cnt);
			}
			if(m1 < a[i].d){
				m1 = a[i].d;
			}
			if(m > a[i].u){
				m = a[i].u;
			}
			if(m < a[i].u){
				if(a[i].ti - cnt >= a[i].u - m)m = a[i].u;
				else m += (a[i].ti - cnt);
			}
			cnt = a[i].ti;
			if(m1 > a[i].u || m < a[i].d)ok = 0;
		}
		if(ok)cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}


#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define db double
#define endl "\n"
#define fi first
#define se second
#define pii pair<int,int>
#define fo(a,b,c) for(int a = b;a <= c;a++)
#define mem(a,b) memset(a,b,sizeof a);
const int inf = 0x3f3f3f3f;
const int maxn = 1e2 + 30;
const int mod = 1e9 + 7;
struct node{
	int ti , d , u;
	friend bool operator < (node a, node b){
		if(a.ti == b.ti && a.d == b.d)return a.u < b.u;
		if(a.ti == b.ti)return a.d > b.d;
		return a.ti < b .ti;

	}
};
node a[maxn];
int main(){
	int t , n , m;cin >> t;
	while(t--){
		scanf("%d%d",&n,&m);
		bool ok = 1;
		fo(i,1,n){
			scanf("%d%d%d",&a[i].ti,&a[i].d,&a[i].u);
		}
		int cnt = 0 , m1 = m;
		fo(i,1,n){
			if(m1 > a[i].d){
				if(a[i].ti - cnt >= m1 - a[i].d)m1 = a[i].d;
				else m1 -= (a[i].ti - cnt);
			}
			if(m1 < a[i].d){
				m1 = a[i].d;
			}
			if(m > a[i].u){
				m = a[i].u;
			}
			if(m < a[i].u){
				if(a[i].ti - cnt >= a[i].u - m)m = a[i].u;
				else m += (a[i].ti - cnt);
			}
			cnt = a[i].ti;
			if(m1 > a[i].u && m > a[i].d)ok = 0;
		}
		if(ok)cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}


#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define db double
#define endl "\n"
#define fi first
#define se second
#define pii pair<int,int>
#define fo(a,b,c) for(int a = b;a <= c;a++)
#define mem(a,b) memset(a,b,sizeof a);
const int inf = 0x3f3f3f3f;
const int maxn = 1e2 + 30;
const int mod = 1e9 + 7;
struct node{
	int ti , d , u;
};
bool cmp(node a, node b){
		if(a.ti == b.ti && a.d == b.d)return a.u < b.u;
		if(a.ti == b.ti)return a.d > b.d;
		return a.ti < b .ti;
}
node a[maxn];
int main(){
	int t , n , m;cin >> t;
	while(t--){
		scanf("%d%d",&n,&m);
		bool ok = 1;
		fo(i,1,n){
			scanf("%d%d%d",&a[i].ti,&a[i].d,&a[i].u);
		}
		sort(a + 1 , a + 1 + n , cmp);
		int cnt = 0;
		fo(i,1,n){
			if(a[i].d > m){
				if(a[i].ti - cnt >= a[i].d - m)
					cnt = a[i].ti , m = a[i].d;
				else ok = 0;
			}
			else if(a[i].u < m){
				if(a[i].ti - cnt >= m - a[i].u)
					cnt = a[i].ti, m = a[i].u;
				else ok = 0;
			}
		}
		if(ok)cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}


#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define db double
#define endl "\n"
#define fi first
#define se second
#define pii pair<int,int>
#define fo(a,b,c) for(int a = b;a <= c;a++)
#define mem(a,b) memset(a,b,sizeof a);
const int inf = 0x3f3f3f3f;
const int maxn = 1e2 + 30;
const int mod = 1e9 + 7;
struct node{
	int ti , d , u;
};
bool cmp(node a, node b){
		if(a.ti = b.ti && a.d == b.d)return a.u < b.u;
		if(a.ti == b.ti)return a.d > b.d;
		return a.ti > b .ti;
}
node a[maxn];
int main(){
	int t , n , m;cin >> t;
	while(t--){
		scanf("%d%d",&n,&m);
		bool ok = 1;
		fo(i,1,n){
			scanf("%d%d%d",&a[i].ti,&a[i].d,&a[i].u);
		}
		sort(a + 1 , a + 1 + n , cmp);
		int cnt = 0;
		fo(i,1,n){
			if(a[i].d > m){
				if(a[i].ti - cnt >= a[i].d - m)
					cnt = a[i].ti , m = a[i].d;
				else ok = 0;
			}
			else if(a[i].u < m){
				if(a[i].ti - cnt >= m - a[i].u)
					cnt = a[i].ti, m = a[i].u;
				else ok = 0;
			}
		}
		if(ok)cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}


#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define db double
#define endl "\n"
#define fi first
#define se second
#define pii pair<int,int>
#define fo(a,b,c) for(int a = b;a <= c;a++)
#define mem(a,b) memset(a,b,sizeof a);
const int inf = 0x3f3f3f3f;
const int maxn = 1e2 + 30;
const int mod = 1e9 + 7;
struct node{
	int ti , d , u;
	friend bool operator < (node a, node b){
		if(a.ti == b.ti && a.d == b.d)return a.u < b.u;
		if(a.ti == b.ti)return a.d > b.d;
		return a.ti < b .ti;

	}
};
node a[maxn];
int main(){
	int t , n , m;cin >> t;
	while(t--){
		scanf("%d%d",&n,&m);
		bool ok = 1;
		fo(i,1,n){
			scanf("%d%d%d",&a[i].ti,&a[i].d,&a[i].u);
		}
		int cnt = 0 , m1 = m;
		fo(i,1,n){
			m1 = min(m1 - (a[i].ti - cnt) , a[i].d);
			m = max(m + (a[i].ti - cnt) , a[i].u);
			cnt = a[i].ti;
			if(m1 > a[i].u || m < a[i].d)ok = 0;
		}
		if(ok)cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}


#include <bits/stdc++.h>
#define int long long
#define float long double
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void solve(){
	int n , m ;
	cin >> n >> m ;
	int l = m , r = m ;
	int t = 0 ; bool flag = true;
	for(int i=0;i<n;i++){
		int ll ,rr ,tt  ;
		cin >> tt >> ll >> rr ;
//		debug() << imie(l) imie(ll) imie(r) imie(rr) imie(t) imie(tt) imie(tt-t) ;
		if( rr < l-tt+t or r+tt-t < ll ){
			flag = false;
		}else{
			l = max(ll,l-tt+t);
			r = min(rr,r+tt-t);
			t=tt;
		}
	}
	cout << ( flag?"YES":"NO" ) << endl ;
}

signed main(){
	IOS;
	int test ;
	cin >> test;
	while(test--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

signed main(){
	IOS;
	int test ;
	cin >> test ;
	while(test--){
		int n,m ;
		cin >> n >> m ;
		int cur_time = 0 ;
		int a = m , b = m ;
		bool flag = true;
		for(int i=0;i<n;i++){
			int t , l , h ;
			cin >> t >> l >> h ;
			a = a - t + cur_time;
			b = b + t - cur_time ;
			if(!(a > h or b < l)){
				a = max(a,l);
				b = min(b,h);
				debug() << imie(t) imie(l) imie(h) imie(a) imie(b) imie(cur_time);
			}else{
				flag = false;
				break;
			}
			if(b<a) flag = false;
			cur_time = t ;
		}
		if(b<a) flag=false;
		cout << ( flag?"YES":"NO" ) << endl;
	}
	return 0 ;
}


#include <bits/stdc++.h>
#define int long long
#define float long double
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

void solve(){
	int n , m ;
	cin >> n >> m ;
	int l = m , r = m ;
	int t = 0 ;
	for(int i=0;i<n;i++){
		int ll ,rr ,tt  ;
		cin >> tt >> ll >> rr ;
		if( rr < l-tt+t or r+tt-t < ll ){
			cout << "NO" << endl ;
			return;
		}else{
			l = max(ll,l-tt+t);
			r = min(rr,r+tt-t);
			t=tt;
		}
	}
	cout << "YES" << endl ;
}

signed main(){
	IOS;
	int test ;
	cin >> test;
	while(test--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

signed main(){
	IOS;
	int test ;
	cin >> test ;
	while(test--){
		int n,m ;
		cin >> n >> m ;
		int cur_time = 0 ;
		int a = m , b = m ;
		bool flag = true;
		for(int i=0;i<n;i++){
			int t , l , h ;
			cin >> t >> l >> h ;
			a = a - t + cur_time ;
			b = b + t - cur_time ;
			if(a <= h and b >= l){
				a = max(a,l);
				b = min(b,h);
				debug() << imie(t) imie(l) imie(h) imie(a) imie(b);
			}else{
				flag = false;
				break;
			}
			cur_time = t ;
		}
		cout << ( flag?"YES":"NO" ) << endl;
	}
	return 0 ;
}


#include <bits/stdc++.h>
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

signed main(){
	IOS;
	int test ;
	cin >> test ;
	while(test--){
		int n,m ;
		cin >> n >> m ;
		int cur_time = 0 ;
		int a = m , b = m ;
		bool flag = true;
		for(int i=0;i<n;i++){
			int t , l , h ;
			cin >> t >> l >> h ;
			a = a - t + cur_time;
			b = b + t - cur_time ;
			if(!(a > h and b < l)){
				a = max(a,l);
				b = min(b,h);
				debug() << imie(t) imie(l) imie(h) imie(a) imie(b) imie(cur_time);
			}else{
				flag = false;
				break;
			}
			if(b<a) flag = false;
			cur_time = t ;
		}
		if(b<a) flag=false;
		cout << ( flag?"YES":"NO" ) << endl;
	}
	return 0 ;
}


#include <bits/stdc++.h>
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

signed main(){
	IOS;
	int test ;
	cin >> test ;
	while(test--){
		int n,m ;
		cin >> n >> m ;
		int cur_time = 0 ;
		int a = m , b = m ;
		bool flag = true;
		for(int i=0;i<n;i++){
			int t , l , h ;
			cin >> t >> l >> h ;
			a = a - t + cur_time;
			b = b + t - cur_time ;
			if(!(a > h and b < l)){
				a = max(a,l);
				b = min(b,h);
				debug() << imie(t) imie(l) imie(h) imie(a) imie(b) imie(cur_time);
			}else{
				flag = false;
				break;
			}
			cur_time = t ;
		}
		if(b<a) flag=false;
		cout << ( flag?"YES":"NO" ) << endl;
	}
	return 0 ;
}


#include <bits/stdc++.h>
#define int long long
#define float long double
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void solve(){
	int n , m ;
	cin >> n >> m ;
	int l = m , r = m ;
	int t = 0 ;
	for(int i=0;i<n;i++){
		int ll ,rr ,tt  ;
		cin >> tt >> ll >> rr ;
//		debug() << imie(l) imie(ll) imie(r) imie(rr) imie(t) imie(tt) imie(tt-t) ;
		if( rr < l-tt+t or r+tt-t < ll ){
			cout << "NO" << endl ;
			return;
		}else{
			l = max(ll,l-tt+t);
			r = min(rr,r+tt-t);
			t=tt;
		}
	}
	cout << "YES" << endl ;
}

signed main(){
	IOS;
	int test ;
	cin >> test;
	while(test--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
#define int long long
#define float long double
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void solve(){
	int n , m ;
	cin >> n >> m ;
	int l = m , r = m ;
	int t = 0 ;
	bool flag = true ;
	for(int i=0;i<n;i++){
		int ll ,rr ,tt  ;
		cin >> tt >> ll >> rr ;
		// debug() << imie(l) imie(ll) imie(r) imie(rr) imie(t) imie(tt) imie(tt-t) ;
		if(l<=r){
			l = max(ll,l-tt+t);
			r = min(rr,r+tt-t);
			t = tt;
		}else{
			cout << "NO" << endl;
			return ;
		}
	}
	if(l>r) flag = false;
	cout << ( flag?"YES":"NO" ) << endl;
}

signed main(){
	IOS;
	int test ;
	cin >> test;
	while(test--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
#define int long long
#define float long double
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void solve(){
	int n , m ;
	cin >> n >> m ;
	int l = m , r = m ;
	int t = 0 ;
	for(int i=0;i<n;i++){
		int ll ,rr ,tt  ;
		cin >> tt >> ll >> rr ;
		debug() << imie(l) imie(ll) imie(r) imie(rr) imie(t) imie(tt) imie(tt-t) ;
		if( rr < l-tt+t or r+tt-t < ll ){
			cout << "NO" << endl ;
			return;
		}else{
			l = max(ll,l-tt+t);
			r = min(rr,r+tt-t);
			t=tt;
		}
	}
	cout << "YES" << endl ;
}

signed main(){
	IOS;
	int test ;
	cin >> test;
	while(test--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
#define int long long
#define float long double
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void solve(){
	int n , m ;
	cin >> n >> m ;
	int l = m , r = m ;
	int t = 0 ; bool flag = true;
	for(int i=0;i<n;i++){
		int ll ,rr ,tt  ;
		cin >> tt >> ll >> rr ;
//		debug() << imie(l) imie(ll) imie(r) imie(rr) imie(t) imie(tt) imie(tt-t) ;
		if( rr < l-tt+t or r+tt-t < ll ){
			flag = false;
		}else{
			l = max(ll,l-tt+t);
			r = min(rr,r+tt-t);
			t=tt;
		}
	}
	cout << ( flag?"YES":"NO" ) << endl ;
}

signed main(){
	int test ;
	cin >> test;
	while(test--)
		solve();
	return 0;
}


#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

#define $(x) (int)  ((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector

#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else
    #define dbg(x)
#endif

void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(9);
    solve();
    return 0;
}

const int MOD = 998244353, MAXN = 1e2 + 10, INF = 1e9 + 10;

void query() {
    int n, m;
    cin >> n >> m;
    int d = m, u = m;
    int pt = 0;
    bool flag = true;
    for (int i = 1; i <= n; ++i) {
        int l, h, t;
        cin >> t >> l >> h;
        int dist = t - pt;
        pt = t;
        u += dist;
        d -= dist;
        u = min(u, h);
        d = max(d, l);

        if (u < d) {
            flag = false;
        }
    }
    if (flag) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

void solve() {
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        query();
    }
}


#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

#define $(x) (int)  ((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector

#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else
    #define dbg(x)
#endif

void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(9);
    solve();
    return 0;
}

const int MOD = 998244353, MAXN = 1e2 + 10, INF = 1e9 + 10;

void query() {
    int n, m;
    cin >> n >> m;
    int d = m, u = m;
    int pt = 0;
    for (int i = 1; i <= n; ++i) {
        int l, h, t;
        cin >> t >> l >> h;
        int dist = t - pt;
        pt = t;
        u += dist;
        d -= dist;
        u = min(u, h);
        d = max(d, l);

        if (u < d) {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

void solve() {
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        query();
    }
}


#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

#define $(x) (int)  ((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector

#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else
    #define dbg(x)
#endif

void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(9);
    solve();
    return 0;
}

const int MOD = 998244353, MAXN = 1e2 + 10, INF = 1e9 + 10;

void query() {
    int n, m;
    cin >> n >> m;
    int d = m, u = m;
    int pt = 0;
    for (int i = 1; i <= n; ++i) {
        int l, h, t;
        cin >> t >> l >> h;
        int dist = t - pt;
        pt = t;
        u += dist;
        d -= dist;
        u = min(u, h);
        d = max(d, l);
        if (u < d) {
            cout << "NO" << endl;
            return;
        }
    }
    if (u < d) assert(0);
    cout << "YES" << endl;
}

void solve() {
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        query();
    }
}


#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

#define $(x) (int)  ((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector

#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else
    #define dbg(x)
#endif

void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(9);
    solve();
    return 0;
}

const int MOD = 998244353, MAXN = 1e2 + 10, INF = 1e9 + 10;

void query() {
    int n, m;
    cin >> n >> m;
    int d = m, u = m;
    vec<int> t(n + 1);
    for (int i = 1; i <= n; ++i) {
        int l, h;
        cin >> t[i] >> l >> h;
        int dist = t[i] - t[i - 1];
        // if (dist == 0) {
        //     u = min(u, h);
        //     d = max(d, l);
        //     if (u < d) {
        //         cout << "NO" << endl;
        //         return;
        //     }
        //     continue;
        // }
        if (h >= u) {
            u = min(h, u + dist);
        }
        else {
            u = h;
        }
        if (l <= d) {
            d = max(l, d - dist);
        }
        else {
            d = l;
        }
        // if (u < d) {
        //     cout << "NO" << endl;
        //     return;
        // }
        if (d > h || u < l) {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

void solve() {
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        query();
    }
}


#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

#define $(x) (int)  ((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector

#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else
    #define dbg(x)
#endif

void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(9);
    solve();
    return 0;
}

const int MOD = 998244353, MAXN = 1e2 + 10, INF = 1e9 + 10;

void query() {
    int n, m;
    cin >> n >> m;
    int d = m, u = m;
    vec<int> t(n + 1);
    for (int i = 1; i <= n; ++i) {
        int l, h;
        cin >> t[i] >> l >> h;
        int dist = t[i] - t[i - 1];
        if (h >= u) {
            u = min(h, u + dist);
        }
        else {
            u = h;
        }
        if (l <= d) {
            d = max(l, d - dist);
        }
        else {
            d = l;
        }
        // dbg(u << " " << d)
        if (u < d) {
            cout << "NO" << endl;
            return;
        }
        if (d > h || u < l) {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

void solve() {
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        query();
    }
}


#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

#define $(x) (int)  ((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector

#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else
    #define dbg(x)
#endif

void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(9);
    solve();
    return 0;
}

const int MOD = 998244353, MAXN = 1e2 + 10, INF = 1e9 + 10;

void query() {
    int n, m;
    cin >> n >> m;
    int d = m, u = m;
    vec<int> t(n + 1);
    int pt = 0;
    for (int i = 1; i <= n; ++i) {
        int l, h, t;
        // cin >> t[i] >> l >> h;
        cin >> t >> l >> h;
        int dist = t - pt;
        pt = t;
        // int dist = t[i] - t[i - 1];
        // if (dist == 0) {
        //     u = min(u, h);
        //     d = max(d, l);
        //     if (u < d) {
        //         cout << "NO" << endl;
        //         return;
        //     }
        //     continue;
        // }
        if (h >= u) {
            u = min(h, u + dist);
        }
        else {
            u = h;
        }
        if (l <= d) {
            d = max(l, d - dist);
        }
        else {
            d = l;
        }
        // if (u < d) {
        //     cout << "NO" << endl;
        //     return;
        // }
        if (d > h || u < l) {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

void solve() {
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        query();
    }
}


#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

#define $(x) (int)  ((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector

#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else
    #define dbg(x)
#endif

void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(9);
    solve();
    return 0;
}

const int MOD = 998244353, MAXN = 1e2 + 10, INF = 1e9 + 10;

void query() {
    int n, m;
    cin >> n >> m;
    int d = m, u = m;
    int pt = 0;
    for (int i = 1; i <= n; ++i) {
        int l, h, t;
        cin >> t >> l >> h;
        int dist = t - pt;
        pt = t;
        if (dist == 0) {
            u = min(u, h);
            d = max(d, l);
            if (u < d) {
                cout << "NO" << endl;
                return;
            }
            continue;
        }
        if (h >= u) {
            u = min(h, u + dist);
        }
        else {
            u = h;
        }
        if (l <= d) {
            d = max(l, d - dist);
        }
        else {
            d = l;
        }
        if (u < d) {
            cout << "NO" << endl;
            return;
        }
        if (d > h || u < l) {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

void solve() {
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        query();
    }
}


#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

#define $(x) (int)  ((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector

#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else
    #define dbg(x)
#endif

void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(9);
    solve();
    return 0;
}

const int MOD = 998244353, MAXN = 1e2 + 10, INF = 1e9 + 10;

void query() {
    int n, m;
    cin >> n >> m;
    int d = m, u = m;
    int pt = 0;
    for (int i = 1; i <= min(n, 10ll); ++i) {
        int l, h, t;
        cin >> t >> l >> h;
        int dist = t - pt;
        pt = t;
        u += dist;
        d -= dist;
        u = min(u, h);
        d = max(d, l);
        if (u < d) {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

void solve() {
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        query();
    }
}