Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

C. Biathlon

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputPerhaps many have heard that the World Biathlon Championship has finished. Although our hero Valera was not present at this spectacular event himself and only watched it on TV, it excited him so much that he decided to enroll in a biathlon section.

Of course, biathlon as any sport, proved very difficult in practice. It takes much time and effort. Workouts, workouts, and workouts, — that's what awaited Valera on his way to great achievements in biathlon.

As for the workouts, you all probably know that every professional biathlete should ski fast and shoot precisely at the shooting range. Only in this case you can hope to be successful, because running and shooting are the two main components of biathlon. Valera has been diligent in his ski trainings, which is why he runs really fast, however, his shooting accuracy is nothing to write home about.

On a biathlon base where Valera is preparing for the competition, there is a huge rifle range with *n* targets. Each target have shape of a circle, and the center of each circle is located on the *Ox* axis. At the last training session Valera made the total of *m* shots. To make monitoring of his own results easier for him, one rather well-known programmer (of course it is you) was commissioned to write a program that would reveal how many and which targets Valera hit. More specifically, for each target the program must print the number of the first successful shot (in the target), or "-1" if this was not hit. The target is considered hit if the shot is inside the circle or on its boundary. Valera is counting on you and perhaps, thanks to you he will one day win international competitions.

Input

The first line of the input file contains the integer *n* (1 ≤ *n* ≤ 10^{4}), which is the number of targets. The next *n* lines contain descriptions of the targets. Each target is a circle whose center is located on the *Ox* axis. Each circle is given by its coordinate of the center *x* ( - 2·10^{4} ≤ *x* ≤ 2·10^{4}) and its radius *r* (1 ≤ *r* ≤ 1000). It is guaranteed that no two targets coincide, intersect or are nested into each other, but they can touch each other.

The next line contains integer *m* (1 ≤ *m* ≤ 2·10^{5}), which is the number of shots. Next *m* lines contain descriptions of the shots, which are points on the plane, given by their coordinates *x* and *y* ( - 2·10^{4} ≤ *x*, *y* ≤ 2·10^{4}).

All the numbers in the input are integers.

Targets and shots are numbered starting from one in the order of the input.

Output

Print on the first line a single number, the number of targets hit by Valera. Print on the second line for each of the targets the number of its first hit or "-1" (without quotes) if this number does not exist. Separate numbers with spaces.

Examples

Input

3

2 1

5 2

10 1

5

0 1

1 3

3 0

4 0

4 0

Output

2

3 3 -1

Input

3

3 2

7 1

11 2

4

2 1

6 0

6 4

11 2

Output

3

1 2 4

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/23/2017 04:14:44 (c4).

Desktop version, switch to mobile version.
User lists

Name |
---|