rt,
#include<bits/stdc++.h>
using namespace std;
int n;
int tree[10005][130],tot;
string a;
bool vis[100005];
bool pan(string s){
int len=s.size(),u=1;
bool flag=0;
for(int i=0;i<len;i++){
int x=s[i];
if(!tree[u][x]) tree[u][x]=++tot;
else if(i==len-1) flag=1;
u=tree[u][x];
if(vis[u])
flag=1;
}
vis[u]=1;
return flag;
}
void help(){
memset(tree,0,sizeof(tree));
memset(vis,0,sizeof(vis));
cin>>n;
for(int i=1;i<=n;i++){
cin>>a;
if(pan(a)){
cout<<"NO\n";
return ;
}
}
cout<<"YES\n";
return ;
}
int main(){
int t;
cin>>t;
while(t--)
help();
return 0;
}