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: ASM32-GCC MAWK BC BF C NCSHARP C++ 4.3.2 CPP14 COBOL COFFEE D-CLANG D DART ELIXIR FANTOM FORTH GOSU GRV JULIA KTLN LUA NODEJS OBJC OCAML OCT PIKE PROLOG PYPY3 PYTHON3 R RACKET RUST CHICKEN ST SQLITE SWIFT UNLAMBDA

hide comments
2014-03-30 17:49:54 silence_dogood
thank you(y)
2014-03-30 17:46:59 cegprakash
silence_dogood: It is possible. Will share the editorial after the contest. Congrats on your ACC using double!
2014-03-30 17:45:47 silence_dogood
how to do it in just int?
2014-03-30 13:21:01 cegprakash
The first ACC solution uses float ftw. Carefully handled! :D
2014-03-30 08:56:38 Rishav Goyal
Hint : To get Ac, avoid Cos, sin to be more precise. Try to keep everything in int, long long int.!!!!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.