总结
根据pos排序,区间合法温度与后一个区间合法温度合并,不满足则no
const int N=100+5;
struct node
{
int pos,l,r;
void input()
{
cin>>pos>>l>>r;
}
bool operator<(const node &b)const
{
return pos<b.pos;
}
} s[N];
signed main()
{
IOS;
//file();
int t;
cin>>t;
while(t--)
{
int n,m;
cin>>n>>m;
for(int i=1; i<=n; i++)
s[i].input();
sort(s+1,s+n+1);
int l=m,r=m,flag=1;
for(int i=1; i<=n; i++)
{
l-=abs(s[i].pos-s[i-1].pos);
r+=abs(s[i].pos-s[i-1].pos);;
l=max(l,s[i].l),r=min(r,s[i].r);
if(l>r)
flag=0;
}
cout<<(flag?"YES":"NO")<<endl;
}
return 0;
}