#include <bits/stdc++.h>
using namespace std;
inline int sqr(int x) { return x * x; }
int main() {
  int n, m, x, y;
  map<int, int> targets;
  vector<int> ans, r;
  scanf("%d", &n);
  ans.assign(n, -1);
  r.assign(n, 0);
  for (int i = 0; i != n; ++i) {
    scanf("%d%d", &x, &r[i]);
    targets[x] = i;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    auto target = targets.lower_bound(x);
    if (target != targets.end()) {
      if (ans[target->second] == -1 &&
          sqr(target->first - x) + sqr(y) <= sqr(r[target->second]))
        ans[target->second] = i;
    }
    if (target != targets.begin()) {
      --target;
      if (ans[target->second] == -1 &&
          sqr(target->first - x) + sqr(y) <= sqr(r[target->second]))
        ans[target->second] = i;
    }
  }
  printf("%d\n", n - count(ans.begin(), ans.end(), -1));
  for (auto itans = ans.begin(); itans != ans.end(); ++itans)
    printf("%d ", *itans);
  printf("\n");
  return 0;
}
