#include<iostream>
using namespace std;
int main()
{
int num,n,s,i,o,gx,gy,sum,look,x,y;
int re[n][2];
cin>>num;
while(num--)
{
sum=0;
cin>>n>>s;
s=s*s;
for(i=1;i<=n;i++)
for(o=1;o<=2;o++)
cin>>re[i][o];
cin>>gx>>gy;
for(i=1;i<=n;i++)
{
look=0;
for(o=1;o<=2;o++)
{
if(o==1)
x=re[i][o]-gx;
else
y=re[i][o]-gy;
}
if(x*x+y*y>s)
sum+=1;
}
cout<<sum<<endl;
}
}