/*
 * Warmup Contest #2, September 4, 2010 Problem B 
 * Solution by Nathaniel Barshay
 * Originally from http://ncpc.idi.ntnu.no/ncpc2007/ncpc2007problems.pdf (problem A) 
 * ACM NCPC 2007 Problem A
 * 
 * Put all strings into a set (treeset). Check if the prefix 
 * of any string is in the set.
 *
 * Ignore the list of macros at the start of the code. 
 */


#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <queue>
#include <complex>
#include <queue>
#include <string.h>
#include <fstream>
#include <stack>
#include <assert.h>
#include <time.h>
using namespace std;

#define IT(c) typeof((c).begin())

#define For(i, a, b) for(int (i) =  int(a); i < int(b); ++i)
#define rep(x, n) For(x,0,n)
#define forit(c, i) for(IT(c) i = (c).begin(); i != (c).end(); ++i)

#define bound(num, lower, upper) (max(min((num),((upper)-1)),(lower)))
#define debug(x) cerr << #x << " = " << x << "\n"

#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mp make_pair

#define setmin(a,b) a=min(a,b)
#define setmax(a,b) a=max(a,b)

typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;
typedef pair<int, int> ii;

/*==================================================================================================================*/
int main()
{
int np;cin>>np;
rep(tp,np)
{
	int n;cin>>n;
	set<string> s;
	vector<string> v;
	rep(i,n)
	{
		string ss;cin>>ss;
		v.pb(ss);
		s.insert(ss);
	}
	bool valid=true;
	rep(i,n)
	{
		string hit=v[i];
		For(i,1,sz(hit))
		{
			if(s.count(hit.substr(0,i))) valid=false;
		}
	}
	printf("%s\n", valid?"YES":"NO");
}
}
