Before using the structure of the order to do, this time with a dictionary tree to do ~
#include <stdio.h> #include <string.h> int sz, val[100001]; struct Trie {int ch[10];}
S[100001];
void Init () {memset (s[0].ch,-1, sizeof (s[0].ch));
Memset (val, 0, sizeof (Val));
SZ = 1;
} int idx (char c) {return C-' 0 ';} void Insert (char *ss) {int len = strlen (ss);
int u = 0;
for (int i = 0; i < len; i++) {int c = idx (ss[i]);
if (s[u].ch[c] = =-1) {memset (s[sz].ch,-1, sizeof (s[sz].ch));
S[U].CH[C] = sz;
sz++;
} u = S[u].ch[c];
} Val[u] = 1;
} int Query (char *ss) {int len = strlen (ss);
int u = 0;
for (int i = 0; i < len; i++) {int c = idx (ss[i]);
if (Val[u]) {return 1;
} u = S[u].ch[c];
if (U = =-1) {break;
}} if (U = =-1) {return 0;
} return 1;
} int main () {//freopen ("test0.in", "R", stdin); Freopen ("tEst01.out "," w ", stdout);
int T, n, Flag;
Char cc[11];
scanf ("%d", &t);
while (t--) {flag = 1;
Init ();
scanf ("%d", &n);
for (int i = 0; i < n; i++) {scanf ("%s", CC);
if (flag) {if (I && query (cc)) {flag = 0;
} insert (CC); }} printf (flag?)
Yes\n ":" no\n ");
} return 0;
}