mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 20:16:29 +00:00
28 lines
515 B
C++
28 lines
515 B
C++
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int t, n;
|
||
|
bool flag;
|
||
|
string s[10005];
|
||
|
|
||
|
int main() {
|
||
|
cin >> t;
|
||
|
while (t--) {
|
||
|
flag = false;
|
||
|
cin >> n;
|
||
|
for (int i = 0; i < n; i++) {
|
||
|
cin >> s[i];
|
||
|
}
|
||
|
sort(s, s + n);
|
||
|
for (int i = 0; i < n - 1; i++) {
|
||
|
if (s[i + 1].substr(0, s[i].size()) == s[i]) {
|
||
|
flag = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
cout << (flag ? "NO" : "YES") << endl;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|