#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
double h,r;
struct Cheese{
double x,y,z;
//重载运算符
bool operator<(const Cheese &cpr) const{
return z<cpr.z;
}
}C[1010];
bool flag=0;
bool vis[1010];
void dfs(int now){
//cout<<"now="<<now<<" C.x="<<C[now].z<<endl;
if(h-C[now].z<=r){
flag=1;
return;
}
vis[now]=1;
for(int i=1;i<=n;i++){
if(!vis[i]){
double dist=sqrt((C[now].x-C[i].x)*(C[now].x-C[i].x)+(C[now].y-C[i].y)*(C[now].y-C[i].y)+(C[now].z-C[i].z)*(C[now].z-C[i].z));
if(dist<=2*r) dfs(i);
}
}
}
int main(){
int T;
cin>>T;
while(T--){
memset(vis,0,sizeof(vis));
memset(C,0,sizeof(C));
flag=0;
cin>>n>>h>>r;
for(int i=1;i<=n;i++) cin>>C[i].x>>C[i].y>>C[i].z;
sort(C+1,C+n+1);
for(int i=1;i<=n;i++){
if(C[i].z-r<=0)dfs(i);
}
if(flag)puts("Yes");
else puts("No");
}
return 0;
}