#include <bits/stdc++.h>
using namespace std;
class Target {
 public:
  int firstHit;
  int x, r;
  int input_ind;
  Target(int a = 0, int b = 0, int c = 0) {
    firstHit = -1;
    x = a;
    r = b;
    input_ind = c;
  }
  bool hit(int p_X, int p_Y) {
    return (p_X - x) * (p_X - x) + p_Y * p_Y <= r * r;
  }
  void registerHit(int n) {
    if (firstHit == -1) firstHit = n;
  }
};
bool indCmp(const Target& a, const Target& b) {
  return a.input_ind < b.input_ind;
}
bool coordCmp(const Target& a, const Target& b) { return a.x < b.x; }
int main() {
  int n, a, b;
  cin >> n;
  vector<Target> targets(n);
  for (int(i) = (0); (i) != (n); (i) = (0) > (n) ? (i)-1 : (i) + 1)
    cin >> a >> b, targets[i] = Target(a, b, i);
  sort(targets.begin(), targets.end(), coordCmp);
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    int p = -1;
    for (int step = targets.size(); step > 1; step /= 2)
      while (p + step < targets.size() and a >= targets[p + step].x) p += step;
    for (int j = p - 5; j <= p + 5; j++)
      if (j >= 0 and j < targets.size())
        if (targets[j].hit(a, b)) targets[j].registerHit(i + 1);
  }
  int c = 0;
  for (int(i) = (0); (i) != (targets.size());
       (i) = (0) > (targets.size()) ? (i)-1 : (i) + 1)
    if (targets[i].firstHit != -1) c++;
  sort(targets.begin(), targets.end(), indCmp);
  cout << c << "\n";
  for (int(i) = (0); (i) != (targets.size());
       (i) = (0) > (targets.size()) ? (i)-1 : (i) + 1)
    cout << targets[i].firstHit << " ";
  cout << "\n";
  return 0;
}
