시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 4 4 4 100.000%

문제

This is one of the most basic geometry proximity problems. We are given n points in the plane and we should determine which points are in the vicinity of a particular point. 

Let the set of points P = {p1, p2 , …, pn} , where pi has coordinates (xi, yi). We use d(pi,pj) to denote the distance between the two points. A point pj is in the vicinity of point pi if d(pi,pj) ≤ dv .We may call dv the vicinity distance. Given a set of points P, point pi and dv, your task is to write a program to calculate the number of points which are in the vicinity of point pi

입력

The first line contains an integer n (2≤ n ≤ 1000) which determines the number of points. The following n lines contain two integers which correspond to the coordinates (xi,yi) of each point (-10≤ xi, yi ≤ 106). Then, the following line includes t (1≤ t ≤ 50) indicating the number of test cases, followed by t lines and each line contains 2 positive integers i (1≤ i ≤ n) and dv (1 ≤ dv ≤ 100) which indicate the point pi and its vicinity distance, respectively. 

출력

For each test case, print out in a line the number of points in the vicinity of the corresponding point. 

예제 입력

5
0 0
0 1
1 1
3 -3
2 2
3
1 1
5 3
4 1

예제 출력

1
3
0

힌트