#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=1e6;
long long dist[N];
int T;
bool judge1=true;
struct dio{
long long x,y,z;
}stu[30];
bool cmp(dio a,dio b){
return a.z<b.z;
}
int main(){
scanf("%d",&T);
for(int i=1;i<=T;i++){
int n,h,r;
scanf("%d %d %lld",&n,&h,&r);
for(int j=1;j<=n;j++){
scanf("%lld %lld %lld",&stu[j].x,&stu[j].y,&stu[j].z);
}
sort(stu+1,stu+1+n,cmp);
dist[1]=stu[1].z;
for(int j=2;j<=n;j++){
dist[j]=(stu[j].x-stu[j-1].x)*(stu[j].x-stu[j-1].x)+(stu[j].y-stu[j-1].y)*(stu[j].y-stu[j-1].y)+(stu[j].z-stu[j-1].z)*(stu[j].z-stu[j-1].z);
}
dist[n+1]=h-stu[n].z;
if(dist[1]>r||dist[n+1]>r)judge1=false;
for(int j=2;j<=n;j++){
if(dist[j]>4*r*r){
judge1=false;
break;
}
}
if(judge1)printf("Yes\n");
else printf("No\n");
judge1=true;
}
return 0;
}