Mail.Ru Cup 2018 Round 3
H
Detect Robots
Codeforces
3200
原题
← G→
翻译中…

You successfully found poor Arkady near the exit of the station you've perfectly predicted. You sent him home on a taxi and suddenly came up with a question.

翻译中…

There are $n$ crossroads in your city and several bidirectional roads connecting some of them. A taxi ride is a path from some crossroads to another one without passing the same crossroads twice. You have a collection of rides made by one driver and now you wonder if this driver can be a robot or they are definitely a human.

翻译中…

You think that the driver can be a robot if for every two crossroads $a$ and $b$ the driver always chooses the same path whenever he drives from $a$ to $b$. Note that $a$ and $b$ here do not have to be the endpoints of a ride and that the path from $b$ to $a$ can be different. On the contrary, if the driver ever has driven two different paths from $a$ to $b$, they are definitely a human.

翻译中…

Given the system of roads and the description of all rides available to you, determine if the driver can be a robot or not.

翻译中…

Input

翻译中…

Each test contains one or more test cases. The first line contains a single integer $t$ ($1 \le t \le 3 \cdot 10^5$) — the number of test cases.

翻译中…

The first line of each test case contains a single integer $n$ ($1 \le n \le 3 \cdot 10^5$) — the number of crossroads in the city.

翻译中…

The next line contains a single integer $q$ ($1 \le q \le 3 \cdot 10^5$) — the number of rides available to you.

翻译中…

Each of the following $q$ lines starts with a single integer $k$ ($2 \le k \le n$) — the number of crossroads visited by the driver on this ride. It is followed by $k$ integers $c_1$, $c_2$, ..., $c_k$ ($1 \le c_i \le n$) — the crossroads in the order the driver visited them. It is guaranteed that all crossroads in one ride are distinct.

翻译中…

It is guaranteed that the sum of values $k$ among all rides of all test cases does not exceed $3 \cdot 10^5$.

翻译中…

It is guaranteed that the sum of values $n$ and the sum of values $q$ doesn't exceed $3 \cdot 10^5$ among all test cases.

翻译中…

Output

翻译中…

Output a single line for each test case.

翻译中…

If the driver can be a robot, output "Robot" in a single line. Otherwise, output "Human".

翻译中…

You can print each letter in any case (upper or lower).

翻译中…

Note

翻译中…

In the first example it is clear that the driver used two different ways to get from crossroads $1$ to crossroads $3$. It must be a human.

翻译中…

In the second example the driver always drives the cycle $1 \to 2 \to 3 \to 4 \to 1$ until he reaches destination.

翻译中…

样例

Input #1
1
5
2
4 1 2 3 5
3 1 4 3
Output #1
Human
InputCopy OutputCopy
Input #2
1
4
4
3 1 2 3
3 2 3 4
3 3 4 1
3 4 1 2
Output #2
Robot
InputCopy OutputCopy
题目信息
题号
1056H
时间限制
1 s
内存限制
1024 MB
标签
数据结构
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。