#Q51. 「一本通 2.3 例 1」Phone List

「一本通 2.3 例 1」Phone List

Description

Original source: POJ 3630

Given nn digit strings, each with a length not exceeding 1010, determine whether there exist two strings SS and TT such that SS is a prefix of TT. Multiple test cases are provided.

Input Format

The first line contains an integer TT, representing the number of test cases.

For each test case, the first line contains an integer nn, followed by nn lines each containing a digit string.

Output Format

For each test case, if there exist two digit strings SS and TT such that SS is a prefix of TT, 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 100%100\% of the data, 1T401\le T\le 40, and 1n1041\le n \le 10^4.