#include<iostream>
using namespace std;
int ch[10001][10001];
bool bo[10001];
int x=0;
int tot=0;
void insert(string s,int o)
{
int xv=0;
int len=s.size();
int u=1;
for(int i=0;i<len;++i)
{
int c=s[i]-'a';
if(!ch[u][c])
{
for(int j='1'-'a';j>='9'-'a';j--)
{
if(!ch[u][j])xv=1;
}
ch[u][c]=++tot;
}
u=ch[u][c];
}
bo[u]=true;
if(xv==0&&o!=1)
{
x=1;
cout<<"NO"<<endl;
}
}
int main()
{
int t;
cin>>t;
for(int i=1;i<=t;i++)
{
int n;
cin>>n;
x=0;
for(int j=1;j<=n;j++)
{
string y;
cin>>y;
insert(y,j);
if(x==1)break;
}
if(x==0)cout<<"YES"<<endl;
}
return 0;
}