Hitting the Targets#4410

Hitting the Targets

1 second
256 megabytes
Very easy

A fundamental operation in computational geometry is determining whether two objects touch. For example, in a game that involves shooting, we want to determine if a player's shot hits a target. A shot is a two dimensional point, and a target is a two dimensional enclosed area. A shot hits a target if it is inside the target. The boundary of a target is inside the target. Since it is possible for targets to overlap, we want to identify how many targets a shot hits.

The figure above illustrates the targets (large unfilled rectangles and circles) and shots (filled circles) of the sample input. The origin is indicated by a small unfilled circle near the center.

Input

Input starts with an integer 1 \le m \le 30 indicating the number of targets. Each of the next lines begins with the word rectangle or circle and then a description of the target boundary. A rectangular target's boundary is given as four integers x_1 y_1 x_2 y_2, where x_1 < x_2 and y_1 < y_2. The points (x_1, y_1) and (x_2, y_2) are the bottom-left and top-right corners of the rectangle, respectively. A circular target's boundary is given as three integers . The center of the circle is at and the 0 < r \le 1000 is the radius of the circle.

After the target descriptions is an integer 1 \le n \le 100 indicating the number of shots that follow. The next lines each contain two integers , indicating the coordinates of a shot. All and coordinates for targets and shots are in the range .

Output

For each of the shots, print the total number of targets the shot hits.

Examples

Example 1

Loading
Loading