CPIR - Counting Points In Rectangles

no tags 

You're given a set P of N points in the plane, and a set R of M rectangles (also in the plane Cool).

For each rectangle from R determine the number of points from P that lie inside it or on its sides.

Input

The first line of input contains the integer N. (1 ≤ N ≤ 200000)

Each of the next N lines contains a pair of integers (xi, yi), the coordinates of the i-th point. (0 ≤ xi, yi ≤ 200000)

The next line of input contains the integer M. (1 ≤ M ≤ 200000)

Each of the next M lines contains four integers (x1i, y1i, x2i, y2i), specifying two opposite vertices of the i-th rectangle.

(0 ≤ x1i < x2i ≤ 200000, 0 ≤ y1i < y2i ≤ 200000)

Output

Output exactly M lines, i-th containing the number of points in the i-th rectangle.

Example

Input:
4
0 0
1 3
2 7
3 3
2
0 0 3 3
0 0 3 7

Output:
3
4


Added by:gustav
Date:2014-01-10
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Classic