Rectangles Online (Easy)#2319

Rectangles Online (Easy)

1 second
64 megabytes
Easy

Vasya has plotted distinct points on a plane, each with integer coordinates.

He now wants to quickly determine how many of these points lie within a given rectangle, where the rectangle's sides are parallel to the coordinate axes.

Input

The first line contains the number of points (1 \leq N \leq 100). Each of the next lines contains the coordinates of a point: x_i y_i. The following line contains the number of queries (1 \leq M \leq 100). Each of the next lines describes a query in the format x_1 y_1 x_2 y_2 (0 \leq x_1 \leq x_2 \leq 10^9, 0 \leq y_1 \leq y_2 \leq 10^9). For each query, you must:

  • Count the number of points that are inside the corresponding rectangle (including the boundaries).

  • Remove all counted points.

Output

For each query, output the number of points counted.

Examples

Example 1

Loading
Loading