402821: GYM100889 E Everyone wants Khaleesi

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Everyone wants Khaleesitime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Jorah Mormont and Khal Drogo both like the Khaleesi. Why wouldn't they, she's incredibly hot! But only one of them can get her, right? Since battling it out has become a little old-fashioned, they decided to play a game to decide the winner.

There exists a directed acyclic graph with N nodes, numbered from 1 to N, and M directed edges(no self-loops or multi edges). Jorah is at the node 1 initially. The players play turn by turn, Jorah starts. In every turn, Jorah can move along one directed edge from his current position to any node x, if and only if there exists a directed edge from his current node to node x. Also, Khal can remove any one edge he wants in his turn. The game goes on until Jorah reaches node N, or if he is unable to make any valid move. It is guaranteed that between any pair of nodes, there exists at most one edge.

The Khaleesi is waiting at node N. If Jorah is able to reach this node, he gets to keep her, else, Khal does. Assuming both play optimally, who will win?

Input

The first line of input contains number of test cases, T(1 ≤ T ≤ 10). Every test case starts with two integers N and M(2 ≤ N ≤ 100 and 0 ≤ M ≤ 200). Next M lines contain two integers u and v, signifying that there exists a directed edge from node u to node v(1 ≤ u, v ≤ N). It is guaranteed that the resulting graph is acyclic.

Output

The output must contain T lines. If Jorah wins, output "Jorah Mormont"(without quotes) or else, output "Khal Drogo"(without quotes).

ExampleInput
2
2 1
1 2
5 6
1 2
1 3
2 3
2 4
3 4
4 5
Output
Jorah Mormont
Khal Drogo
Note

Sample test case 1:

Jorah moves from node 1 to node 2 and reaches the Khaleesi. Hence, he wins.

Sample test case 2:

Jorah moves from node 1 to node 3. Then Khal removes the edge from node 3 to node 4. Jorah cannot make any more moves, hence Khal wins.

加入题单

算法标签: