Fire Brigade

No attempts yetTime limit3sMemory limit512 MB

Problem

In Bytau, the capital of Byteotia, the street layout is a perfectly regular grid. Every street runs either north-south or east-west, so each north-south street crosses each east-west street at exactly one intersection. Along any street, consecutive intersections are exactly 11 km apart.

Bytau has zz historic monuments, each standing at a distinct intersection. To protect them from fire, the City Council will build two fire stations. Every monument is guarded by the station nearest to it; if both stations are equally near, the monument is guarded by both.

Because the city is densely built, distance is measured along the streets rather than as the crow flies. The distance between a monument and a fire station is the length of the shortest path along the streets connecting them, that is, the Manhattan distance.

The Council has prepared several candidate placements for the two stations. For each placement, determine how many monuments are guarded by the first station only, by the second station only, and by both stations.

Input

The first line contains four integers nn, mm, zz, and pp (1n,m1091 \le n, m \le 10^9, 1z,p100,0001 \le z, p \le 100{,}000): the number of north-south streets, the number of east-west streets, the number of monuments, and the number of candidate placements.

The north-south streets are numbered 11 to nn from west to east; the east-west streets are numbered 11 to mm from north to south. The intersection of the xx-th north-south street and the yy-th east-west street is written as (x,y)(x, y).

Each of the next zz lines contains two integers xix_i and yiy_i (1xin1 \le x_i \le n, 1yim1 \le y_i \le m): the coordinates of the ii-th monument. No two monuments share an intersection.

Each of the next pp lines contains four integers xj,1x_{j,1}, yj,1y_{j,1}, xj,2x_{j,2}, yj,2y_{j,2} (1xj,1,xj,2n1 \le x_{j,1}, x_{j,2} \le n, 1yj,1,yj,2m1 \le y_{j,1}, y_{j,2} \le m, (xj,1,yj,1)(xj,2,yj,2)(x_{j,1}, y_{j,1}) \ne (x_{j,2}, y_{j,2})): the intersections where the first and second fire stations are placed in the jj-th proposal.

Output

Print exactly pp lines. The jj-th line contains three integers separated by single spaces: the number of monuments guarded by the first station only, by the second station only, and by both stations, for the jj-th placement.