CSES - Point in Polygon
  • Time limit: 1.00 s
  • Memory limit: 512 MB

You are given a polygon of nn vertices and a list of mm 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 nn vertices (x1,y1),(x2,y2),,(xn,yn)(x_1,y_1),(x_2,y_2),\dots,(x_n,y_n). The vertices (xi,yi)(x_i,y_i) and (xi+1,yi+1)(x_{i+1},y_{i+1}) are adjacent for i=1,2,,n1i=1,2,\dots,n-1, and the vertices (x1,y1)(x_1,y_1) and (xn,yn)(x_n,y_n) are also adjacent.

Input

The first input line has two integers nn and mm: the number of vertices in the polygon and the number of points.

After this, there are nn lines that describe the polygon. The iith such line has two integers xix_i and yiy_i.

You may assume that the polygon is simple, i.e., it does not intersect itself.

Finally, there are mm lines that describe the points. Each line has two integers xx and yy.

Output

For each point, print "INSIDE", "OUTSIDE" or "BOUNDARY".

Constraints

  • 3n,m10003 \le n,m \le 1000
  • 1m10001 \le m \le 1000
  • 109xi,yi109-10^9 \le x_i, y_i \le 10^9
  • 109x,y109-10^9 \le x, y \le 10^9

Example

Input:

4 3
1 1
4 2
3 5
1 4
2 3
3 1
1 3

Output:

INSIDE
OUTSIDE
BOUNDARY