ZOJ Problem Set - 3784
Given a set of banned words S, please find out whether it is possible to construct a string str1..∞ with infinite length that fulfills the following constrains:
There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:
The first line contains two integers N (1 <= N <= 100) and M (1 <= M <= 26). The following N lines, each line contains contains a non-empty string indicating a banned word in S. The length of each word will not exceed 1000 and the word only consists of lowercase letters.
For each test case, output "Yes" if it is possible to construct such a string, otherwise "No".
2 2 2 aa bb 1 2 aa
Author: CHEN, Weijie
Source: The 11th Zhejiang Provincial Collegiate Programming Contest