CF1056H Detect Robots

题目描述

有一张 $n$ 个点的图,给你 $m$ 条路径,每条路径中每个点最多出现一次,如果存在两个点 $A$、$B$,他们在两跳不同的路径中均出现,且在两条路经中 $A$ 到 $B$ 之间的点依次有一个点不同,则输出“Human”,否则输出"Robot"。 数据范围为 $3\times 10^5$。 ---

输入格式

每组数据第一行输入两个整数n,m; 第2~m+1行每行先给出k表示这条路径一共经过k个点,然后输入这k个点 ----

输出格式

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

说明/提示

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.