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.
Input
The first line contains the integer n (3 ≤ n ≤ 5000). Each of the next n lines contains a point with integer coordinates (up to 10^{9} 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 10^{9} by absolute value) that represents a standing point.
Output
For each standing point output “EDGE” if you stand on one of the tracks. Otherwise output the number of full turns in positive direction.
Sample
input  output 

8
2 2
5 1
2 4
1 3
2 0
3 1
2 2
1 1
3
2 1
0 0
1 2
 2
EDGE
0

Problem Author: Vladimir Yakovlev