#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn=100010;
struct node{int p,ch[30];}a[maxn];
int cnt,n,T;
int main(){
char x[25];
cin>>T;
while(T--){
cnt=0; memset(a,0,sizeof(a));
int flag=0;
cin>>n;
cnt=1;
for(int i=1;i<=n;i++){
scanf("%s",&x);
int len=strlen(x);
int cur=1,l=0;
for(int j=0;j<len;j++){
if(!a[cur].ch[x[j]-'0']){
a[cur].ch[x[j]-'0']=++cnt;
cur=cnt;
}else{
l++;
cur=a[cur].ch[x[j]-'0'];
if(a[cur].p==1)flag=1;
}
}
if(l==len)flag=1;
a[cur].p=1;
}
if(flag)cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}return 0;
}