PLAYGAME - PLAYGAME

Hemlata and Ritu were playing a game from a number of coins. Hemlata was jealous of Ritu. She wanted to win at all cost. A stack consists of n coins. Any player can take either 1, 2 or 5 (anyone number of coins) coins from stack at a time. Both Hemlata and Ritu play their moves alternatively.

Hemlata always starts first. Both play optimally. Your job is to predict the output beforehand. A player who can't take any coin loses the game. A player can take only one of 1, 2, 5 number of coins at a time in a move.

Input

First line contains number of testcases t. 0 < t <= 10^5

An integer n denoting number of coins. 0 <= n <= 10^18

Output

For each testcase printf "Hemlata" if Hemlata wins, else print "Ritu" if Ritu wins (without quotes) in different lines .

Example

Input:
3
1
2
3
Output:
Hemlata
Hemlata
Ritu

Added by:Sandeep Kumar Singh
Date:2017-03-07
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:gametheory

hide comments
2019-12-01 09:28:27
Simple one!!
C -0.03sec
CPP -0.38sec
CPP14 -0.38sec
PYTHON -1.14sec
PYTHON3 -1.42sec
and as usual,
JAVA gave TLE :(
2018-06-12 20:55:58
50 :)
2017-03-25 18:20:57
@useandthrowone: Basic game theory knowledge :)
2017-03-23 22:21:07
t>0
2017-03-17 22:57:54
can we solve this using dp? n is too large
2017-03-17 19:31:03
Can someone plz mention the topics to be learnt to solve this problem?
2017-03-09 00:24:18
aman224: what are the rules? "A player who can't take any coin loses the game". Seems clear to me...
2017-03-08 21:32:28 wisfaq
@vengatesh15: O(1) should be O(t).
As t is rather large you can't ignore t.
2017-03-08 14:54:05
@mahmud2690 Yes
2017-03-08 14:09:48
O(1) solution tutorial stuff :-)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.