You have just completed the construction of your model railway. The railway is made in a form of a closed route, the tracks may intersect and overlap one another in different levels. You're standing at some point and follow the locomotive with your eyes. Once the locomotive completes a full circle you want to say how many full turns around your axis you made.
The first line contains the integer n (3 ≤ n ≤ 5000). Each of the next n lines contains a point with integer coordinates (up to 109 by absolute value) that represents the track joint. The tracks are straight segments between successive points in this list. The last joint is connected to the first one with one more track.
The next line contains the integer m (1 ≤ m ≤ 5000). Each of the next m lines contains a point with integer coordinates (up to 109 by absolute value) that represents a standing point.
For each standing point output “EDGE” if you stand on one of the tracks. Otherwise output the number of full turns in positive direction.
Problem Author: Vladimir Yakovlev