Code Submission Evaluation System Login

BOI-leiri 2019

Taxing


Task | Statistics


CSES - TaxingCSES - Taxing

Time limit:1.00 s Memory limit:128 MB

The border of Oopse is a polygon consisting of $n$ straight segments. The vertices of the fence are in order $(x_1,y_1),(x_2,y_2),\ldots,(x_n,y_n)$.

The tax officer of Oopse needs to know for each $m$ houses if they reside in Oopse or not. Unfortunately the officer is bad at reading maps and needs your help.

Input

The first line contains a single integer, $n$, the number of line segments describing the border of Oopse.

The next $n$ lines each consist of two integers $x_i$ and $y_i$: the position of $i^{th}$ vertex is $(x_i, y_i)$.

Then the input contains a single integer, $m$, the number of houses the tax officer needs to query.

The rest $m$ lines each consist of two integers $x_k$ and $y_k$: the position of $k^{th}$ house is $(x_k, y_k)$.

Output

For each house print a single line consisting either of "inside" (the house resides inside Oopse), "border" (the house resides on the border of Oopse) or "outside" (the house resides outside Oopse).

Limits
Example

Input:
5
2 1
3 2
5 1
5 4
2 5
3
3 4
4 5
5 3


Output:
inside
outside
border