多组数据的题虽然已经得到答案了一定还是要把本组数据的输入给读完。。。。不然就死定了
#include<bits/stdc++.h>
#define rep(i,l,r) for(int i=(l);i<=(r);i++)
#define per(i,r,l) for(int i=(r);i>=(l);i--)
#define random(l,r) ((l)+rand()%((r)-(l)+1))
#define myset(a,v) memset((a),(v),sizeof((a)));
using namespace std;
typedef unsigned long long ULL;
typedef long long LL;
const int inf=1e9+10;
const double eps=1e-6;
int t,n,ch[100010][10],num;
bool tail[1000010];
char s[1000];
bool insert(char s[],int len){
int u=0;
rep(i,0,len-1){
int c=s[i]-'0';
if(!ch[u][c]) ch[u][c]=++num;
else if (tail[ch[u][c]]) return true;
u=ch[u][c];
}
rep(i,0,9) if(ch[u][i]) return true;
tail[u]=true;
return false;
}
int main(){
ios::sync_with_stdio(false); cin.tie(0);
cin>>t;
while(t--){
bool ans=false;
num=0; memset(ch,0,sizeof(ch)); memset(tail,0,sizeof(tail));
cin>>n;
while(n--){
cin>>s;
if(insert(s,strlen(s))) ans=true;
}
if(ans) cout<<"NO"<<endl; else cout<<"YES"<<endl;
}
return 0;
}