#include<bits/stdc++.h>
using namespace std;
const int maxn=1010;
int n,t;
long long h,r,a[maxn],b[maxn],c[maxn];
double d;
bool vis[maxn],bbb=0;
void dfs(int x)
{
if(vis[x]||bbb)return;
vis[x]=1;
if(c[x]+r>=h)
{
bbb=1;
return;
}
for(int i=1;i<=n;i++)
{
d=sqrt((a[x]-a[i])*(a[x]-a[i])+(b[x]-b[i])*(b[x]-b[i])+(c[x]-c[i])*(c[x]-c[i]));
if(d<=r+r)dfs(i);
if(bbb)return;
}
}
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d%lld%lld",&n,&h,&r);
for(int i=1;i<=n;i++)
scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);
memset(vis,false,sizeof(vis));
bbb=0;
for(int i=1;i<=n;i++)
if(c[i]<=r)dfs(i);
if(bbb)printf("Yes\n");
else printf("No\n");
}
return 0;
}