#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n, x[1000]={0}, y[1000]={0}, ax, ay, bx, by, q, r1[1000]={0}, r2[1000]={0}, p=1;
while (cin>>n && n!=0){
int m[1000]={0};
for (int i=0; i<n; i++){
cin>>x[n]>>y[n];
}
cin>>ax>>ay>>bx>>by>>q;
for (int i=0; i<q; i++){
cin>>r1[i]>>r2[i];
}
for (int j=0; j<q; j++){
for (int i=0; i<q; i++){
if (sqrt((x[i]-ax)^2-(y[i]-ay)^2)<=r1[j]^2 && sqrt((x[i]-bx)^2-(y[i]-by)^2)<=r2[j]^2) m[j]++;
else continue;
}
}
cout<<"Case "<<p<<':'<<endl;
for (int i=0; i<q; i++){
cout<<m[i]<<endl;
}
}
return 0;
}