import java.io.*;
import java.util.Arrays;
class PHONELST{
public static void main(String ar[])throws Exception{
DataInputStream s= new DataInputStream(System.in);
int i=0,t=0,n=0,flag=0;
//int arr[]=new int[10000];
String str[]=new String[10000];
t=Integer.parseInt(s.readLine());
while(t!=0){
n=Integer.parseInt(s.readLine());
for(i=0;i<n;i++)
str[i]=s.readLine();
Arrays.sort(str);
for(i=0;i<n-1;i++){
if(str[i+1].startsWith(str[i])){
flag=1;
System.out.println("NO");
break;
}
}
if(flag==0)
System.out.println("YES");
flag=0;
t--;
}
}
}