#include <iostream>
#include <vector>
using namespace std;

vector<vector<int> > guests;
vector<bool> visited;

vector<int> matchG, matchU;

bool match(int g)
{
  if(visited[g])
    return false;
  visited[g] = true;

  for(int i = 0; i < guests[g].size(); ++i)
  {
    int u = guests[g][i];
    if(matchU[u] == -1 || match(matchU[u]))
    {
      matchG[g] = u;
      matchU[u] = g;
      return true;
    }
  }
  return false;
}

inline int sq(int a)
{ return a*a; }

int main()
{
  int N; cin >> N;
  for(int i = 1; i <= N; ++i)
  {
    cout << "Scenario #" << i << ":" << endl;

    int t; cin >> t;

    int m; cin >> m;
    vector<vector<int> > gCoords(m);
    for(int g = 0; g < m; ++g)
    {
      gCoords[g].resize(3);
      cin >> gCoords[g][0] >> gCoords[g][1] >> gCoords[g][2];
    }

    int n; cin >> n;
    vector<pair<int, int> > uCoords(n);
    for(int u = 0; u < n; ++u)
      cin >> uCoords[u].first >> uCoords[u].second;

    guests = vector<vector<int> >(m);

    for(int g = 0; g < m; ++g)
      for(int u = 0; u < n; ++u)
        if(sq(gCoords[g][0] - uCoords[u].first) + 
           sq(gCoords[g][1] - uCoords[u].second) <= sq(gCoords[g][2]*t))
          guests[g].push_back(u);

    bool done;
    matchG = vector<int>(m, -1);
    matchU = vector<int>(n, -1);
    do
    { 
      done = true;
      visited = vector<bool>(m, false);
      for(int g = 0; g < m; ++g)
        if(matchG[g] == -1 && match(g))
          done = false;
    } while(!done);

    int count = 0;
    for(int g = 0; g < m; ++g)
      if(matchG[g] != -1)
        ++count;

    cout << count << endl << endl;
  }
}
