#842. 1846. [HDOJ]2471 History of Languages

1846. [HDOJ]2471 History of Languages

#1846. [HDOJ]2471 History of Languages

题目描述

image

输入格式

image

输出格式

For each test case, please print “Yes” if the two languages described by the automatons are equivalent; output “No” otherwise.

样例

样例输入

2  

3  

1 -1 1  

0 -1 2  

0 -1 0  

2  

1 -1 1  

0 -1 0  

  

3  

4  

1 -1 -1 1  

1 -1 -1 2  

1 -1 -1 3  

1 -1 -1 1  

2  

1 -1 -1 1  

1 -1 -1 0  

  

0  

样例输出

Case #1: No  

Case #2: Yes  

数据范围与提示