Point and Polygon#1467

Point and Polygon

1 second
128 megabytes
Easy

How do programmers fix a light bulb?

They don't do it, it's a hardware problem!

Given a simple convex polygon and a point, determine if the point is inside, on the border, or outside the polygon.

Input

The input contains several test cases. Each test case starts with the number of vertices (n \leq 1000) of the polygon, followed by pairs of integers , (-1000 \leq x, y \leq 1000) representing the coordinates of the polygon vertices in counterclockwise order. The next line contains two integers, which are the coordinates of the given point. The input terminates with a line that contains a single .

Output

For each test case, print INSIDE if the point is inside the polygon, ON BORDER if the point lies on a border, or OUTSIDE if the point is outside the polygon.

Examples

Example 1

Loading
Loading