Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/qavariq-kopburchakmi

Is the polygon convex?

Medium 1000 ms 128 MB 62%
Share

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.

A polygon on the coordinate plane; the vertex pushed inwards is highlighted

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

Sign in to submit a solution

Signing up is free and takes a minute.