Watchmen

No attempts yetTime limit2sMemory limit512 MB

Problem

Byteman belongs to the resistance that fights the Evil Emperor occupying Byteland. He is lithe and nimble, so he was picked for the mission of slipping into the Imperial Palace and taking the Emperor's secret blueprints. After a long look at every way into the Palace he settled on the sewers.

The trouble is that the city sewers are cut off from the sewers under the Palace by thick iron bars. So Byteman decided to pass the first line of guards through the city sewers, come up through a gutter on the Imperial Plaza (the huge courtyard of the Palace itself), and then go down a different gutter into the Palace sewers on the other side of the bars.

Watchmen patrol the Imperial Plaza. Each watchman patrols a segment connecting two points. He walks at constant speed from point AA to point BB, makes a sharp turn on the spot without looking around, walks from BB back to AA, turns again, and repeats. The Emperor is keen on smart drill, not necessarily sensible drill, so he ordered every watchman to turn at the same moment, once every minute. A watchman assigned to a segment of length \ell therefore moves \ell per minute.

Byteman knows the segment of every watchman. He can sneak at 10 bytefeet per minute. His special black cloak leaves the watchmen no chance of seeing him while he stands still. If he moves while in the view of any watchman, he is spotted and caught. In particular, he cannot enter or exit a gutter at a moment when it is in the view of any watchman. The watchmen see infinitely far, but they have no eyes in the back of their heads, so they see only what lies in the closed 180180^\circ angle in front of them. Assume the Imperial Plaza is infinitely large.

Byteman is not sure that every gutter is usable. To improve his chances he wants to count, for each gutter he can use to leave the city sewers, how many Palace gutters he can reach from it. There are far too many gutters for him to do this alone, so he asks for your help.

Input

The first line contains three integers nn, mm and pp (1n,m,p1051 \le n, m, p \le 10^5), separated by single spaces, denoting the number of watchmen, the number of gutters leading to the city sewers, and the number of gutters leading to the Palace sewers.

The next nn lines describe the patrolled segments. Each line contains four integers x1x_1, y1y_1, x2x_2, y2y_2 (2×107x1,y1,x2,y22×107-2 \times 10^7 \le x_1, y_1, x_2, y_2 \le 2 \times 10^7), separated by single spaces, meaning that this watchman patrols the segment between (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2). The two points are distinct. At the start the watchman stands at (x1,y1)(x_1, y_1) and faces (x2,y2)(x_2, y_2). The coordinate system is chosen so that the distance between (0,0)(0, 0) and (1,0)(1, 0) is one bytefoot.

The next m+pm + p lines give the positions of the gutters. Each line contains two integers xx and yy (2×107x,y2×107-2 \times 10^7 \le x, y \le 2 \times 10^7), separated by a single space, meaning that the gutter is at (x,y)(x, y). The first mm lines describe the gutters connected to the city sewers, the next pp lines the gutters connected to the Palace sewers.

The input is chosen so that the answer would not change if each gutter were moved by at most 10710^{-7} bytefoot.

Output

Write mm lines. The ii-th line should contain a single integer, the number of gutters connected to the Palace sewers that can be reached from the gutter given ii-th in the input.

Notes

In the first example the first gutter is in the view of some watchman the whole time. The second watchman starts looking at it at the very moment the third watchman turns his back to it.

Both Palace gutters are reachable from the second gutter. For the first one it is enough to wait a minute and 42 seconds until the first watchman loses the gutter (5,6)(5, 6) from view. The second and third watchmen lose it earlier. The remaining 18 seconds are enough to walk calmly to the gutter (5,8)(5, 8).

Reaching the gutter (7,4)(7, 4) takes a bit more work. Leave the gutter after 102 seconds again, but this time spend the 18 seconds left before the watchmen turn around on reaching the point (5.5,4.5)(5.5, 4.5). Wait there for 30 seconds, then run freely to the gutter (7,4)(7, 4).