Geometry
Geometry-15
Geometry-16
Geometry-17
~/algor $ cat problems/qavariq-kopburchakmi
Is the polygon convex?
Medium
1000 ms
128 MB
62%
A polygon with $n$ vertices is given on the plane: its vertices $(x_{1}; y_{1}), (x_{2}; y_{2}), \ldots, (x_{n}; y_{n})$ are listed in order (clockwise or counterclockwise). The polygon does not intersect itself, and no three of its consecutive vertices lie on one line. If the polygon is convex, print HA, otherwise print YOQ.
Input
The first line contains a positive integer $n$. Each of the next $n$ lines contains two integers: $x_{i}$ and $y_{i}$.
Output
One line with the corresponding word: HA or YOQ.
Note
$3 \le n \le 10^{5}$
$-10^{9} \le x_{i}, y_{i} \le 10^{9}$
Examples
Input #1
5 0 0 4 0 2 1 4 4 0 4
Output #1
YOQ
Input #2
4 0 0 4 0 4 4 0 4
Output #2
HA