FACENEMY - Face the mate

Hero Heroine
Hero and Heroine are standing on a 2D plane. Hero is standing at (x1, y1) facing towards (u1, v1) and the heroine is standing at (x2, y2) facing towards (u2, v2), both trying to find the location of the other one. Both of them are lazy and they don't move. Instead, they just change the direction they face, standing at the same position. To make things easier, both of them starts scanning simultaneously with same rotation speed. To make things even more easier, assume that they choose the direction which will help to find their mate as fast as possible. Print "Hero" if the Hero finds Heroine faster; print "Heroine" if the Heroine finds Hero faster. Print "0" otherwise.

Assume that both of them don't have any field of view and all they can see are the points in the straight line that they face.

Input:

The first line consists of an integer t, the number of test cases. For each test case, the first line consists of 8 non-negative integers x1, y1, u1, v1, x2, y2, u2 and v2.

Output:

For each test case, print the result in the required format as specified in the problem statement.

Input Constraints:

1<=t<=500000

0<=xi, yi, ui, vi<=100

(x1, y1) != (x2, y2) Both players are located at different positions.

(x1, y1) != (u1, v1)

(x2, y2) != (u2, v2) Players don't face their own locations.

Sample Input:

10
9 3 6 0 4 4 6 6
1 8 6 3 4 9 7 8
8 2 3 5 9 1 9 8
4 0 3 6 7 6 1 5
4 2 7 3 0 9 7 2
6 0 5 7 1 6 5 4
1 2 1 4 0 0 6 0
7 1 7 7 7 7 3 3
5 9 1 8 9 8 2 6
6 0 0 1 3 8 2 5

Sample Output:

0
Hero
Heroine
Hero
Heroine
Heroine
Heroine
Hero
Heroine
Heroine

Added by:cegprakash
Date:2014-03-10
Time limit:2.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: BF GOSU

hide comments
2021-08-04 23:40:37
All coordinates are integers, as statement claims.
2021-07-15 13:54:11 Sushovan Sen
Code of problem is FACENEMY when story is about Hero and Heroine. Strange!

Reply by cegprakash: I wanted to make a thriller story but then wanted to make it more romantic.

Last edit: 2023-09-08 16:44:02
2014-10-07 05:05:25 shiv prasad chabarval
:D
many WA because of float input :/
2014-09-21 22:05:37 ivar.raknahs
take care => all coordinates are in float.
nice geometry problem.
AC.


Last edit: 2014-09-21 22:06:20
2014-06-04 21:08:18 cegprakash
Try to avoid floats and doubles!
2014-05-26 19:53:55 shiv prasad chabarval
@cegprakash plz check my solution its working fine for all test cases i have tried but WA :(
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.