After his new game idea was finally solved, jackyliao123 returns home from school and unwinds in his room for the rest of the evening. He was in the middle of downloading more Rem when his phone rang. It was his old friend, who had called to ask for advice on his side project!
In Slither.io, the player is a snake who tries to survive in a world of legless reptiles. Because one dies in the event of a head-on collision with another player, jackyliao123 is tasked with implementing a component of the path-finding algorithm which actively seeks to avoid such collisions.
The current instance of time in the game contains
other players, representing the points which the player character wants to avoid. However, the player has
instances of the game open and as a result, must update the game-state for their path-finding.
The
opposing snakes
and the
queried snakes
are represented by an ordered pair in the Cartesian plane.
For each of the
queried snakes controlled by the player, jackyliao123 must determine the squared distance of the nearest point from the
opposing points
, and the number of those
points which have a squared distance equal to
.
Can you write a program to help jackyliao123 help his friend?
Input Specification
The first line of the input will contain a single integer
, denoting the number of opposing snakes to consider.
The next
lines will each contain two space-separated integers
, representing the location of the
opponent.
The next line will contain a single integer
, denoting the number of Slither.io games the player is playing simultaneously.
The next
lines will each contain two space-separated integers
, representing the location of the
player character.
Constraints
Subtask 1 [20%]


Subtask 2 [80%]


Output Specification
Your program should output two space-separated integers on a single line for each of the
queries.
The first integer
represents the square of the Euclidean distance between the queried point and the closest of the
snakes.
The second integer represents the number of points from the set of
opponents whose squared distance from the queried point is equal to
.
Sample Input
Copy
3
0 0
98 0
100 0
2
1 0
49 0
Sample Output
Copy
1 1
2401 2
Comments
Is there any possibility that test case 5 in batch 2 is incorrect? Given that none of the solutions so far have gotten 100/100, it seems a bit suspicious. Of course, my solution could just be completely wrong (and it probably is...)
Edit: after many years, I have decided to fix the data (hopefully).