Bradonja
Captain Bradonja and his crew are the most terrifying pirates of the blue seas (and of those not so blue, polluted ones). One day, as they were searching a lost island for treasures they ran into a very hard problem, hard even for a pirate like Bradonja. Namely, the entrance to the cave in which the treasure lies is guarded by an angry fire demon who will not allow them to enter unless they correctly answer his questions. To make matters worse, if they give a wrong answer to at least one of his questions he will dispatch them all to hell. The demon drew a big convex polygon on the ground, marked all its corners and then said K times coordinates of a random dot in plane, and Bradonja and his crew are expected to tell him, for each dot, whether it is inside the polygon or not.
Help our hero and Bradonja will probably share his newly-gotten treasure with you! We hope so...
In the next N rows there are N pairs of coordinates that represent corners of a convex polygon, given in counter-clockwise direction - each pair in a separate row. No two corners will have both coordinates the same.
In the next K rows there are pairs of coordinates representing dots in plane.
All coordinates will be natural numbers from interval [1, 60 000].
8 1
10 4
10 7
8 10
5 10
3 7
3 4
5 1
8 1
4 8Output
13 2
1 1
3 1
1 3
2 2
2 3Output
1
0Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.