favorite We need a little bit of your help to keep things running, click on this banner to learn more

Week 2: November 16 – 22. Conditional statement. Part 3

New Sergey's game

C-student Sergey often asks A-student Vasya to do his homework. Vasya is genius, but he still cann't cope with the work instantly, so Sergey waits. Sergey is boring long because of nothing to do. Not so long ago he came up with a new game to pass the time.

On the white table with coordinate system Sergey puts a rectangular sheet of black paper. Above it he puts a rectangular piece of white paper so that possible it overlaps a portion of the black sheet. The parties of both sheets of paper are parallel to the coordinate axes. After that, the boy chooses a point on the plane of the table. If it hits the black sheet, Serge believes that the expectations are not boring, otherwise he gets upset.

Help Sergey to understand, is he upset or not.


First given the coordinates of upper left corner of black rectangle, then bottom right, the the coordinates of angles of white rectangle in the same format and at last the point's coordinates are given. All coordinates are integer, not greater than 10000 by absolute value.


Print "SAD" if Sergey is sad (if the point falls on the boundary, Sergey thinks it belongs to the black sheet), and "HAPPY" otherwise.

Time limit 1 second
Memory limit 128 MiB
Input example #1
2 10 5 3 4 4 6 1 2 9
Output example #1
Input example #2
2 10 5 3 4 4 6 1 6 3
Output example #2