#include<bits/stdc++.h>
#define rint register int
using namespace std;
int n,h,r,T,now,nowh;
struct node{
int x;
int y;
int z;
};
node p[1010];
bool v[1010];
bool check1(node x,node y)
{
if(sqrt((x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y)+(x.z-y.z)*(x.z-y.z))<=2*r)
return true;
else
return false;
}
bool check2(node x)
{
if(x.z<=r)
return true;
else
return false;
}
//bool check3(struct x)
//{
// if(x.z+r>=h)
// return true;
// else
// return false;
//}
bool dfs(node x)
{
// v[now]=1;
if(nowh>=h)
return true;
for(rint i=1;i<=n;i++)
{
if(check1(x,p[i]) && p[i].z+r>=nowh && i!=now)
{
nowh=p[i].z+r;
now=i;
dfs(p[i]);
}
}
return false;
}
int main()
{
cin>>T;
for(rint o=1;o<=T;o++)
{
memset(p,0,sizeof(p));
// memset(v,0,sizeof(v));
now=0;
nowh=0;
cin>>n>>h>>r;
for(rint i=1;i<=n;i++)
{
cin>>p[i].x>>p[i].y>>p[i].z;
}
for(rint i=1;i<=n;i++)
{
if(check2(p[i]))
{
now=i;
nowh=p[i].z+r;
dfs(p[i]);
if(dfs(p[i])==true)
{
cout<<"Yes"<<endl;
break;
}
// cout<<"jkhdsk";
}
if(i==n)
{
cout<<"No"<<endl;
}
}
}
return 0;
}