#Q51. 「一本通 2.3 例 1」Phone List
「一本通 2.3 例 1」Phone List
Description
Original source: POJ 3630
Given digit strings, each with a length not exceeding , determine whether there exist two strings and such that is a prefix of . Multiple test cases are provided.
Input Format
The first line contains an integer , representing the number of test cases.
For each test case, the first line contains an integer , followed by lines each containing a digit string.
Output Format
For each test case, if there exist two digit strings and such that is a prefix of , output NO; otherwise, output YES.
Please note the correspondence between the result and the output here!
Sample 1
2
3
911
97625999
91125426
5
113
12340
123440
12345
98346
NO
YES
Constraints and Hints
For of the data, , and .
Related
In following homework: