#include <iostream>
#include <cstdio>
using namespace std;
struct router{
int x,y,r;
};
struct location{
int x,y;
};
router rr[105];
location loc[12];
int main()
{
int t,kase=1;
int a,b,c,d,e;
bool f,found;
cin>>t;
int routers,locations;
while(t--)
{
cin>>routers>>locations;
f=0;
for(int i=0;i<routers;i++)
{
cin>>rr[i].x>>rr[i].y>>rr[i].r;
}
for(int i=0;i<locations;i++)
{
cin>>loc[i].x>>loc[i].y;
}
for(int i=0;i<locations;i++)
{
a=loc[i].x;b=loc[i].y;
found=0;
for(int j=0;j<routers;j++)
{
c=rr[j].x; d=rr[j].y;
e=rr[j].r;
e*=e;
//cout<<"e "<<c<<" "<<d<<" "<<e<<"\n";
if((a-c)*(a-c)+(b-d)*(b-d)<=e)
{
if(!f)
cout<<"Case "<<kase++<<":\n";
f=1;
cout<<"Yes\n";
found=1;
break;
}
}
if(!found)
{
if(!f)
cout<<"Case "<<kase++<<":\n";
f=1;
cout<<"No\n";
}
}
}
return 0;
}