• محدودیت زمان: ۱ ثانیه
  • محدودیت حافظه: ۲۵۶ مگابایت

The contest area for the programming competition at Semnan University is a convex polygon with \(n\) sides. You will be asked \(q\) questions. In each question, the coordinates of a student are given, and you need to determine whether the student is inside the contest area or not.

input

The first line of input contains a positive integer \(n\), representing the number of vertices of the polygon that defines the contest area in counter clockwise order.

The i-th line of the next \(n\) lines contain two integers, \(x_i\) and \(y_i\), representing the coordinates of i-th vertex of the polygon in order.

The following line contains the integer \(q\), indicating the number of students.

again In next \(q\) lines, the i-th line contains two integers, \(x_i\) and \(y_i\), representing the coordinates of a student.

\[1 \leq n \leq 10^5\] \[1 \leq q \leq 10^6\] \[|x_i, y_i| \leq 10^9\]

output

For each student, print "IN" if they are within the contest area, or "OUT" if they are not.

example

sample input 1

4
0 0
10 0
10 10
0 10
2
5 5
15 15

sample output 1

IN
OUT
ارسال پاسخ برای این سؤال
فایلی انتخاب نشده است.