- Time limit: 1.00 s
- Memory limit: 512 MB
You are given a polygon of vertices and a list of points. Your task is to determine for each point if it is inside, outside or on the boundary of the polygon.
The polygon consists of vertices . The vertices and are adjacent for , and the vertices and are also adjacent.
Input
The first input line has two integers and : the number of vertices in the polygon and the number of points.
After this, there are lines that describe the polygon. The th such line has two integers and .
You may assume that the polygon is simple, i.e., it does not intersect itself.
Finally, there are lines that describe the points. Each line has two integers and .
Output
For each point, print "INSIDE", "OUTSIDE" or "BOUNDARY".
Constraints
Example
Input:
4 3 1 1 4 2 3 5 1 4 2 3 3 1 1 3
Output:
INSIDE OUTSIDE BOUNDARY