//HK算法模板题
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn=3030;
using namespace std;
int e[maxn*maxn],ne[maxn*maxn],h[maxn*maxn],idx;
struct node {
double x,y,v;
} a[maxn];
int lx[maxn],ly[maxn],dx[maxn],dy[maxn];
bool vis[maxn];
int T,n,m,t,dis;
void init() {
memset(lx,-1,sizeof(lx));
memset(ly,-1,sizeof(ly));
memset(h,-1,sizeof(h));
idx = 0;
}
void add(int a,int b) {
e[idx]=b;
ne[idx]=h[a];
h[a]=idx++;
}
double dist(double x, double y, double xx, double yy) {
return sqrt((x - xx) * (x - xx) + (y - yy) * (y - yy));
}
bool Search() {
queue<int> q;
dis = inf;
memset(dx,-1,sizeof(dx));
memset(dy,-1,sizeof(dy));
for(int i=0; i<n; i++) {
if(lx[i] == -1) {
q.push(i);
dx[i] = 0;
}
}
while(!q.empty()) {
int u = q.front();
q.pop();
if(dx[u] > dis)
break;
for(int i=h[u]; i!=-1; i=ne[i]) {
int v = e[i];
if(dy[v] == -1) {
dy[v] = dx[u] + 1;
if(ly[v] == -1)
dis = dy[v];
else {
dx[ly[v]] = dy[v] + 1;
q.push(ly[v]);
}
}
}
}
return dis != inf;
}
bool dfs(int u) {
for(int i=h[u]; i!=-1; i=ne[i]) {
int v = e[i];
if(!vis[v] && dy[v] == dx[u] + 1) {
vis[v] = true;
if(ly[v] != -1 && dy[v] == dis) continue;
if(ly[v] == -1 || dfs(ly[v])) {
ly[v] = u;
lx[u] = v;
return true;
}
}
}
return false;
}
int Hopcroft_Karp() {
int sum = 0;
while( Search() ) {
memset(vis,false,sizeof(vis));
for(int i=0; i<n; i++) {
if(lx[i] == -1 && dfs(i))
sum ++;
}
}
return sum;
}
int main() {
int Case = 1;
scanf("%d",&T);
while(T--) {
init();
scanf("%d%d",&t,&n);
for(int i=0; i<n; i++)
scanf("%lf%lf%lf",&a[i].x,&a[i].y,&a[i].v);
scanf("%d",&m);
for(int i=0; i<m; i++)
{
double xx, yy;
scanf("%lf%lf",&xx,&yy);
for(int j=0; j<n; j++) {
double zz = dist(xx, yy, a[j].x, a[j].y);
if(a[j].v * t >= zz)
add(j ,i);
}
}
int ans = Hopcroft_Karp();
printf("Scenario #%d:
%d
",Case ++, ans);
}
return 0;
}