import java.util.*;

class Matcher
{
  private boolean[] visited;
  private int[] leftMatch, rightMatch;
  private boolean[][] adj;
  private int m, n;

  public Matcher(boolean[][] adj) {
    this.adj = adj;
    m = adj.length;
    n = adj[0].length;
  }
  
  private boolean dfs(int left) {
    if (visited[left]) return false;
    visited[left] = true;
    for (int i = 0; i < n; ++i)
      if (adj[left][i] && (rightMatch[i] == -1 || dfs(rightMatch[i]))) {
        leftMatch[left] = i;
        rightMatch[i] = left;
        return true;
      }
    return false;
  }

  public int compute() {
    int matches = 0;
    leftMatch = new int[m];
    rightMatch = new int[n];
    for (int i = 0; i < m; ++i) leftMatch[i] = -1;
    for (int i = 0; i < n; ++i) rightMatch[i] = -1;
    boolean didChange;
    do { 
      visited = new boolean[m];
      didChange = false;
      for (int i = 0; i < m; ++i) {
        if (leftMatch[i] == -1 && dfs(i)) {
          didChange = true;
          ++matches;
        }
      }
    } while (didChange);
    return matches;
  }
}

class Solution
{
  public static int maxmatch(boolean[][] adj) {
    return new Matcher(adj).compute();
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    for (int I = 1; I <= N; ++I) {
      int t = sc.nextInt();
      int m = sc.nextInt();

      int[] xpos = new int[m], ypos = new int[m], speed = new int[m];
      for (int i = 0; i < m; ++i) {
        xpos[i] = sc.nextInt();
        ypos[i] = sc.nextInt();
        speed[i] = sc.nextInt() * t;
      }

      int n = sc.nextInt();
      boolean[][] adj = new boolean[m][n];
      for (int i = 0; i < n; ++i) {
        int x = sc.nextInt(), y = sc.nextInt();

        for (int j = 0; j < m; ++j) {
          int dx = xpos[j] - x;
          int dy = ypos[j] - y;
          int s = speed[j];
          adj[j][i] = dx*dx + dy*dy <= s*s;
        }
      }
      
      System.out.println("Scenario #" + I + ":");
      System.out.println(maxmatch(adj));
      System.out.println();
    }
  }
}

