You are asked to help diagnose class diagrams to identify instances of diamond inheritance. The following example class diagram illustrates the property of diamond inheritance. There are four classes: and . An arrow pointing from to indicates that class inherits from class .
In this class diagram, inherits from both and , inherits from , and also inherits from . An inheritance path from to is defined as a sequence of classes , , , , , , where inherits from , inherits from for , and inherits from . There are two inheritance paths from to in the example above. The first path is , , and the second path is , , .
A class diagram is said to contain a diamond inheritance if there exists a pair of classes and such that there are at least two different inheritance paths from to . The above class diagram is a classic example of diamond inheritance. Your task is to determine whether or not a given class diagram contains a diamond inheritance.
输入格式
The first line of the input gives the number of test cases, . test cases follow, each specifies a class diagram. The first line of each test case gives the number of classes in this diagram, . The classes are numbered from to . lines follow. The line starts with a non-negative integer indicating the number of classes that class inherits from. This is followed by distinct positive integers each from to representing those classes. You may assume that:
If there is an inheritance path from to then there is no inheritance path from to .
A class will never inherit from itself.
输出格式
For each diagram, output one line containing "Case #: ", where is the case number (starting from ) and is "Yes" if the class diagram contains a diamond inheritance, "No" otherwise.