#include<iostream>#include<cstdio>#include<string>#include<cstring>#include<algorithm>usingnamespace std;constint N =100010;int t, n;char s[10];int tr[N][10], cnt[N], idx;voidinsert(char str[]){
int p =0;for(int i =0; str[i]; i++){
int u = str[i]-'0';if(!tr[p][u]) tr[p][u]=++idx;
p = tr[p][u];}
cnt[p]++;}boolquery(char str[]){
int p =0;for(int i =0; str[i]; i++){
int u = str[i]-'0';if(!tr[p][u])returnfalse;
p = tr[p][u];if(cnt[p]>0)returntrue;}returntrue;}intmain(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cin >> t;while(t--){
idx =0;memset(cnt,0,sizeof cnt);memset(tr,0,sizeof tr);
cin >> n;bool flag =true;while(n--){
cin >> s;if(query(s)) flag =false;insert(s);}if(flag) cout <<"YES"<< endl;else cout <<"NO"<< endl;}return0;}