#include<bits/stdc++.h>
using namespace std;
#define int long long
//多测要清空
struct node{
int x,y,z;
}zms[1005];
int T,n,h,r,a,b,c,fa[1005];
int find(int x){
if(fa[x]==x)return x;
fa[x]=find(fa[x]);
return fa[x];
}
void uni(int x,int y){
int fx=find(x);
int fy=find(y);
fa[fx]=fy;
}
signed main(){
// freopen("P3958.in","r",stdin);
//freopen("P3958.out","w",stdout);
cin>>T;
for(int t=1;t<=T;t++){
cin>>n>>h>>r;
for(int i=0;i<=n+1;i++)fa[i]=i;
for(int i=1;i<=n;i++){
cin>>a>>b>>c;
zms[i]={a,b,c};
if(c<=r){
uni(0,i);
}
if(h-c<=r){
uni(n+1,i);
}
}
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
int x=zms[i].x;
int y=zms[i].y;
int z=zms[i].z;
int xx=zms[j].x;
int yy=zms[j].y;
int zz=zms[j].z;
if(dis(x,y,z,xx,yy,zz)<=2*r){
uni(i,j);
}
}
}
if(find(0)==find(n+1)){
cout<<"Yes\n";
}
else cout<<"No\n";
}
return 0;
}
/*
2 5202 1301
0 0 1301
102 1 3901
*/
对于这组数据,我手玩和程序答案都是yes,但标程给出来的是no,请问为什么?