#3262. [HDOJ]2471 History of Languages

[HDOJ]2471 History of Languages

Background

Special for beginners, ^_^

Description

Format

Input

Output

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

Samples

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

Limitation

1s, 1024KiB for each test case.