# Include <iostream> # include <stdio. h> # include <string. h> # include <stdlib. h> using namespace STD; typedef struct node {struct node * Next [10]; int flag;} node, * tree; int flag1; void creat (Tree & T) {T = (node *) malloc (sizeof (node); t-> flag = 0; For (INT I = 0; I <10; I ++) t-> next [I] = NULL;} void insert (Tree & T, char * s) {tree P = T; int t; int L = strlen (s ); for (INT I = 0; I <L; I ++) {T = s [I]-'0'; If (p-> next [T] = N Ull) creat (p-> next [T]); P = p-> next [T]; If (p-> flag> 0) flag1 = 0 ;} p-> flag ++;} void D (tree p) {for (INT I = 0; I <10; I ++) {If (p-> next [I]! = NULL) d (P-> next [I]);} Free (p);} int CMP (const void * a, const void * B) {return strcmp (char *) A, (char *) B);} Char A [10001] [30]; int main (){
Tree T; int TT, M; scanf ("% d", & TT); While (TT --) {creat (t); flag1 = 1; scanf ("% d", & M); For (INT I = 0; I <m; I ++) {scanf ("% s", a [I]);
} Qsort (a, m, sizeof (A [0]), CMP); For (INT I = 0; I <m; I ++ ){
Insert (t, a [I]);} If (flag1) printf ("Yes \ n ");
Else printf ("NO \ n"); D (t );
} Return 0 ;}