CF1056H.Detect Robots

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 nn 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 aa and bb the driver always chooses the same path whenever he drives from aa to bb . Note that aa and bb here do not have to be the endpoints of a ride and that the path from bb to aa can be different. On the contrary, if the driver ever has driven two different paths from aa to bb , 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.

输入格式

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

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

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

Each of the following qq lines starts with a single integer kk ( 2kn2 \le k \le n ) — the number of crossroads visited by the driver on this ride. It is followed by kk integers c1c_1 , c2c_2 , ..., ckc_k ( 1cin1 \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 kk among all rides of all test cases does not exceed 31053 \cdot 10^5 .

It is guaranteed that the sum of values nn and the sum of values qq doesn't exceed 31053 \cdot 10^5 among all test cases.

输出格式

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).

输入输出样例

  • 输入#1

    1
    5
    2
    4 1 2 3 5
    3 1 4 3
    

    输出#1

    Human
    
  • 输入#2

    1
    4
    4
    3 1 2 3
    3 2 3 4
    3 3 4 1
    3 4 1 2
    

    输出#2

    Robot
    

说明/提示

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

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

首页