You are given $n$ strings $s_1, s_2, \ldots, s_n$ consisting of lowercase Latin letters.

In one operation you can remove a character from a string $s_i$ and insert it to an arbitrary position in a string $s_j$ ($j$ may be equal to $i$). You may perform this operation any number of times. Is it possible to make all $n$ strings equal?


-----Input-----

The first line contains $t$ ($1 \le t \le 10$): the number of test cases.

The first line of each test case contains a single integer $n$ ($1 \le n \le 1000$): the number of strings.

$n$ lines follow, the $i$-th line contains $s_i$ ($1 \le \lvert s_i \rvert \le 1000$).

The sum of lengths of all strings in all test cases does not exceed $1000$.


-----Output-----

If it is possible to make the strings equal, print "YES" (without quotes).

Otherwise, print "NO" (without quotes).

You can output each character in either lowercase or uppercase.


-----Example-----
Input
4
2
caa
cbb
3
cba
cba
cbb
4
ccab
cbac
bca
acbcc
4
acb
caf
c
cbafc

Output
YES
NO
YES
NO



-----Note-----

In the first test case, you can do the following:   Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the first string, making both strings equal to "cab". 

In the second test case, it is impossible to make all $n$ strings equal.

Difficulty: EASY

Solutions:
for i in range(int(input())):
	n = int(input())
	d = dict()
	for i in range(n):
		s = input()
		for x in s:
			d[x] = d.get(x, 0) + 1
	l = 'YES'
	for x in d.keys():
		if d[x] % n != 0:
			l = 'NO'
			break
	print(l)


test = int(input())

def solve():
	n = int(input())
	s = ''
	arr = [0] * 26
	p = 0
	for x in range(n):
		s += input()
	for y in s:
		arr[ord(y) - 97] += 1
	arr = dict.fromkeys(arr)
	for z in arr:
		p += z % n
	if p == 0:
		print('YES')
	else:
		print('NO')
for x in range(test):
	solve()


import io
import os
import sys
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def printd(*args, **kwargs):
	print(*args, **kwargs)
	pass

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
t = oint()
for _ in range(t):
	n = oint()
	c = dict()
	for i in range(n):
		s = get_str()
		for cc in s:
			if cc in c:
				c[cc] += 1
			else:
				c[cc] = 1
	for cc in c.values():
		if cc % n:
			print('NO')
			break
	else:
		print('YES')


from collections import *
for u in range(int(input())):
	n = int(input())
	c = Counter()
	for i in range(n):
		s = input()
		for j in s:
			c[j] += 1
	f = 0
	for i in c:
		if c[i] % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	a = n
	i = 0
	c = 0
	s = []
	while n:
		x = input()
		s.append(x)
		i += 1
		n -= 1
	dic = {}
	for i in s:
		for x in i:
			if x not in dic:
				dic[x] = 0
			dic[x] += 1
	for i in dic:
		if dic[i] % a != 0:
			c = 1
			break
	if c == 0:
		print('YES')
	elif c == 1:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	words = []
	n = int(input())
	for i in range(n):
		j = input()
		words.append(j)
	letters = [0] * 26
	for i in range(n):
		for j in range(len(words[i])):
			letters[ord(words[i][j]) - ord('a')] += 1
	flag = True
	for i in range(len(letters)):
		if letters[i] % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


from collections import Counter
t = int(input())
for _ in range(t):
	s = ''
	n = int(input())
	for i in range(n):
		s += input()
	di = dict(Counter(s))
	flag = 0
	for (i, j) in di.items():
		if j % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


from collections import defaultdict

def solve(arr, n):
	d = defaultdict(list)
	for i in range(n):
		for x in arr[i]:
			if x in d:
				d[x] += 1
			else:
				d[x] = 1
	for x in d:
		if d[x] % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [None] * n
	for i in range(n):
		arr[i] = input()
	print(solve(arr, n))


test = int(input())
for t in range(test):
	n = int(input())
	str2 = ''
	for m in range(n):
		str = input()
		str2 = str2 + str
	all_freq = {}
	for i in str2:
		if i in all_freq:
			all_freq[i] += 1
		else:
			all_freq[i] = 1
	y = True
	for k in all_freq.values():
		if k % n != 0:
			y = False
	if y == False:
		print('NO')
	else:
		print('YES')


for i1 in range(int(input())):
	n = int(input())
	s = ''
	for i2 in range(n):
		s += input()
	dic = {}
	for i in s:
		dic[i] = 0
	for i in s:
		dic[i] += 1
	t = 0
	for key in dic:
		if dic[key] % n != 0:
			t = 1
			break
	if t == 0:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	e = ''
	f = int(input())
	for j in range(f):
		r = input()
		e += r
	q = 0
	for i in e:
		if e.count(i) % f != 0:
			q += 1
	if q == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(input())
	res = {}
	flag = 0
	for i in l:
		for keys in i:
			res[keys] = res.get(keys, 0) + 1
	for i in res.values():
		if i % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	ls = []
	for j in range(0, 26):
		ls.append(0)
	n = int(input())
	for j in range(0, n):
		s = input()
		for k in s:
			b = ord(k) - ord('a')
			ls[b] = ls[b] + 1
	flag = 0
	for k in ls:
		if k % n == 0:
			pass
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


def ans():
	N = int(input())
	for i in range(N):
		c = 1
		b = []
		F = int(input())
		a = 1
		for j in range(F):
			b += sorted(input())
		b = sorted(b)
		for k in range(1, len(b)):
			if b[k] == b[k - 1]:
				a += 1
				c += 1
				if k == len(b) - 1:
					if a % F != 0:
						print('NO')
						c = 0
						break
			elif k == len(b) - 1 and 1 % F != 0:
				print('NO')
				c = 0
				break
			elif a % F != 0:
				print('NO')
				c = 0
				break
			else:
				a = 1
				c += 1
		if c == len(b):
			print('YES')
ans()


from collections import Counter

def solve(N):
	count = Counter()
	for i in range(N):
		string = input()
		for x in string:
			count[x] += 1
	for x in count:
		if count[x] % N == 0:
			continue
		break
	else:
		return 'YES'
	return 'NO'
T = int(input())
for _ in range(T):
	N = int(input())
	res = solve(N)
	print(res)


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	alp = [0] * 26
	for i in range(n):
		for j in inp():
			alp[ord(j) - 97] += 1
	for i in alp:
		if i % n:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = ''
	a = []
	c = 0
	for i in range(n):
		t = input()
		s += t
		for i in t:
			if i not in a:
				a.append(i)
	for i in a:
		if s.count(i) % n != 0:
			c = 1
			break
	if c == 1:
		print('NO')
	else:
		print('YES')


for test in range(int(input())):
	n = int(input())
	freq_arr = {}
	for i in range(n):
		s = input()
		for j in s:
			try:
				freq_arr[j] += 1
			except:
				freq_arr[j] = 1
	ans = 'YES'
	for i in freq_arr:
		if freq_arr[i] % n != 0:
			ans = 'NO'
			break
	print(ans)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	d = {}
	k = n
	while n > 0:
		n -= 1
		a = input()
		for i in a:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	l = 0
	for i in d:
		if d[i] % k != 0:
			l = 1
			break
	if l == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	ans = 0
	mapop = {}
	for i in range(n):
		s = input()
		for j in s:
			if ord(j) not in mapop:
				mapop[ord(j)] = 1
			else:
				mapop[ord(j)] += 1
	k = list(mapop.values())
	flag = True
	for i in k:
		if i % n:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	for _ in range(ii()):
		f = [0] * 256
		n = ii()
		for i in range(n):
			s = si()
			for j in s:
				f[bo(j)] += 1
		f1 = 0
		for i in f:
			if i % n:
				f1 = 1
		if f1:
			print('NO')
		else:
			print('YES')
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(input())
	d = defaultdict(lambda : 0)
	for i in range(n):
		for j in range(len(l[i])):
			d[l[i][j]] += 1
	values = list(d.values())
	c = 1
	for i in range(len(values)):
		if values[i] % n != 0:
			c = 0
			break
	if c:
		print('YES')
	else:
		print('NO')


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def is_juggling(strs: [str]) -> str:
	str_len = len(strs)
	str_count_dic = {}
	for str in strs:
		for s in str:
			str_count_dic[s] = str_count_dic.get(s, 0) + 1
	for str_count in str_count_dic.values():
		if str_count % str_len != 0:
			return 'NO'
	return 'YES'
question_num = inp()
for i in range(question_num):
	str_count = inp()
	strs = []
	for j in range(str_count):
		strs.append(input())
	print(is_juggling(strs))


t = int(input())
for i in range(t):
	n = int(input())
	s = []
	for j in range(n):
		a = str(input())
		a = list(a)
		for g in range(len(a)):
			s.append(a[g])
	s = sorted(s)
	u = 0
	while len(s) > 0:
		k = s.count(s[0])
		if k % n != 0:
			u = 1
			break
		else:
			for l in range(k - 1, -1, -1):
				del s[l]
	if u == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	dic = {}
	s = ''
	for i in range(n):
		st = input()
		s = s + st
	for j in s:
		if j not in dic:
			dic[j] = 1
		else:
			dic[j] += 1
	st = 'YES'
	for i in dic:
		if dic[i] % n != 0:
			st = 'NO'
			break
	print(st)
	t = t - 1


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	n = int(inp())
	cnt = [0] * 26
	for i in range(n):
		curr = list(inp())
		for j in range(len(curr)):
			cnt[ord(curr[j]) - 97] += 1
	for i in range(26):
		if cnt[i] % n == 0:
			continue
		else:
			print('NO')
			return
	print('YES')
testcase(int(inp()))


t = int(input())
strings = list()
chars = set()
f = 0
for i in range(t):
	n = int(input())
	for j in range(n):
		string = input()
		strings.append(string)
		for string in strings:
			for char in string:
				chars.add(char)
	for char in chars:
		f = dict.fromkeys(chars)
	for string in strings:
		for char in string:
			for k in f:
				if k == char:
					if f[k] == None:
						f[k] = 1
					else:
						f[k] += 1
	flag = True
	for (k, v) in f.items():
		if v % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')
	strings = list()
	chars = set()
	f = 0


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	strings = [input().strip() for _ in range(n)]
	c = Counter(strings[0])
	for j in range(1, len(strings)):
		c += Counter(strings[j])
	for k in c:
		if c[k] % n:
			print('NO')
			break
	else:
		print('YES')


import sys
dict_alpha = {chr(97 + i): i for i in range(26)}
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	list_a = [0] * 26
	for _ in range(n):
		for l in sys.stdin.readline().strip():
			list_a[dict_alpha[l]] += 1
	res = 'YES'
	for i in range(26):
		if list_a[i] % n:
			res = 'NO'
			break
	print(res)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	n = int(z())
	d = {}
	for _ in range(n):
		l = z()
		for i in l:
			try:
				d[i] += 1
			except:
				d[i] = 1
	ans = 'YES'
	for i in list(d.values()):
		if i % n != 0:
			ans = 'NO'
			break
	print(ans)


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	d = [0] * 26
	fl = True
	for _ in range(n):
		s = input()
		for i in s:
			d[ord(i) - ord('a')] += 1
	for x in d:
		if x > 0 and x % n:
			fl = False
			break
	print('YES' if fl else 'NO')


for _ in range(int(input())):
	n = int(input())
	m = [0] * 26
	for i in range(n):
		x = input()
		for j in x:
			m[ord(j) - 97] += 1
	x = 0
	for i in m:
		if i % n != 0:
			x = 1
			break
	if x == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for h in range(t):
	n = int(input())
	q = dict()
	for i in range(n):
		s = input()
		for j in s:
			if j in q:
				q[j] += 1
			else:
				q[j] = 1
	ans = 0
	for i in q:
		if q[i] % n != 0:
			ans = 1
			break
	if ans == 0:
		print('YES')
	else:
		print('NO')


def check(al, n):
	for a in al.values():
		if a % n != 0:
			return False
	return True
for _ in range(int(input())):
	alphabet = {}
	n = int(input())
	for _ in range(n):
		s = input()
		for ch in s:
			try:
				alphabet[ch] += 1
			except KeyError:
				alphabet[ch] = 1
	print('YES') if check(alphabet, n) else print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	d = {}
	for i in range(n):
		k = list(input())
		for j in k:
			if j in d:
				d[j] = d[j] + 1
			else:
				d[j] = 1
	f = 0
	for e in d:
		if d[e] % n == 0:
			pass
		else:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


def meta(d, n):
	for x in d:
		if d[x] % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for x in range(len(s)):
			if s[x] in d:
				d[s[x]] += 1
			else:
				d[s[x]] = 1
	print(meta(d, n))


t = int(input())

def solve():
	n = int(input())
	big_string = ''
	for i in range(n):
		big_string += input()
	track = {}
	for i in big_string:
		track[i] = 0
	for i in big_string:
		track[i] = track[i] + 1
	poss = True
	for i in track.keys():
		if track[i] % n != 0:
			poss = False
			break
	if poss:
		print('YES')
	else:
		print('NO')
for i in range(t):
	solve()


for _ in range(int(input())):
	b = ''
	a = int(input())
	for i in range(a):
		b += input()
	c = set(b)
	d = 0
	for j in c:
		if b.count(j) % a == 0:
			d += 1
	if d == len(c):
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = ''
	for i in range(n):
		l += input()
	d = dict(Counter(l))
	c = 0
	for i in d:
		if d[i] % n == 0:
			c += d[i] / n
	if c == len(l) / n:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
for _ in range(int(ri())):
	n = int(ri())
	arr = [0] * 26
	for i in range(n):
		temp = ri()
		for i in temp:
			arr[ord(i) - ord('a')] += 1
	flag = True
	for i in range(26):
		if arr[i] % n != 0:
			flag = False
			break
	if flag:
		YES()
	else:
		NO()


t = int(input())
for j in range(1, t + 1):
	s = ''
	n = int(input())
	for i in range(1, n + 1):
		t = input()
		s = s + t
	l = len(s)
	cnt = 0
	ret = 0
	for i in s:
		if s.count(i) % n == 0:
			cnt += 1
		else:
			print('NO')
			ret = -1
			break
	if ret != -1:
		print('YES')
exit()


for _ in range(int(input())):
	n = int(input())
	d = {}
	x = 0
	for i in range(n):
		s = input()
		for i in set(s):
			if i not in d:
				d[i] = s.count(i)
			else:
				d[i] += s.count(i)
	for i in d.values():
		if i % n != 0:
			print('NO')
			x = 1
			break
	if x == 0:
		print('YES')


n = int(input())
c = 1
k = ''
for i in range(n):
	m = int(input())
	for j in range(m):
		v = input()
		k = k + v
	l = set(k)
	for i in l:
		if k.count(i) % m == 0:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')
	k = ''


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	s = []
	for _ in range(n):
		s.append(input())
	s = ''.join(s)
	c = Counter(s)
	val = True
	for k in c:
		if c[k] % n != 0:
			val = False
			break
	print('YES') if val else print('NO')


import math
from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	strings = []
	for x in range(n):
		s = input()
		strings.append(s)
	d = defaultdict(int)
	for string in strings:
		for char in string:
			d[char] += 1
	ans = True
	for x in d.values():
		if x % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	lis = [0] * 26
	for j in range(n):
		s = str(input())
		a = len(s)
		for k in range(a):
			lis[ord(s[k]) - 97] += 1
	x = 0
	for j in range(26):
		if lis[j] % n != 0:
			x += 1
			break
	if x == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter
import sys
from typing import List, Union

def rl(int_: bool=True, is_split: bool=True) -> Union[List[str], List[int]]:
	if int_:
		return [int(w) for w in sys.stdin.readline().split()]
	if is_split:
		return [w for w in sys.stdin.readline().split()]
	return sys.stdin.readline().strip()
for _ in range(rl()[0]):
	(n,) = rl()
	alpha = Counter()
	for j in range(n):
		alpha += Counter(rl(False)[0])
	if all(map(lambda z: z % n == 0, alpha.values())):
		print('YES')
	else:
		print('NO')


k = int(input())
for i in range(k):
	n = int(input())
	s = [0] * 26
	for j in range(n):
		r = input()
		for l in r:
			s[ord(l) - 97] += 1
	ans = True
	for i in s:
		if i % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for p in range(t):
	n = int(input())
	chars = {}
	for i in range(n):
		s = input()
		for j in s:
			if j not in chars:
				chars[j] = 1
			else:
				chars[j] += 1
	m = len(chars)
	ans = 'YES'
	for i in range(m):
		if list(chars.values())[i] % n != 0:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	for i in range(n):
		a = input()
		for i in range(len(a)):
			if a[i] not in d:
				d[a[i]] = 1
			else:
				d[a[i]] += 1
	flag = 0
	for i in d.keys():
		if d[i] % n != 0:
			print('NO')
			flag = 1
			break
	if flag != 1:
		print('YES')


from collections import *
import sys

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	n = ri()
	letter = []
	for i in range(n):
		for l in input():
			letter.append(l)
	cnt = Counter(letter)
	ans = 'YES'
	for l in cnt:
		if cnt[l] % n != 0:
			ans = 'NO'
			break
	print(ans)


from sys import stdin, stdout
inp = lambda : list(map(int, stdin.readline().split()))

def solve():
	n = inp()[0]
	hash_map = {}
	for j in range(n):
		arr = list(input())
		for i in arr:
			if i in hash_map:
				hash_map[i] += 1
			else:
				hash_map[i] = 1
	for i in hash_map:
		if hash_map[i] % n != 0:
			return 'NO'
	return 'YES'

def main():
	for i in range(inp()[0]):
		print(solve())
main()


for i in range(int(input())):
	n = int(input())
	dict = {}
	flag = 0
	for i in range(n):
		s = input()
		for i in s:
			if i not in dict:
				dict[i] = 1
			else:
				dict[i] += 1
	for i in dict:
		if dict[i] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


def solve(l):
	sum_of_letters = sum([len(s) for s in l])
	if sum_of_letters % len(l) != 0:
		print('NO')
		return
	d = {}
	for s in l:
		for c in s:
			if c in d:
				d[c] += 1
			else:
				d[c] = 1
	for v in d.values():
		if v % len(l) != 0:
			print('NO')
			return
	print('YES')
T = int(input())
for _ in range(T):
	n = int(input())
	l = []
	for _ in range(n):
		s = input()
		l.append(s)
	solve(l)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	c = Counter()
	for i in range(n):
		c += Counter(input())
	if any((c[x] % n != 0 for x in c)):
		print('NO')
	else:
		print('YES')


from math import gcd
from bisect import bisect_left, bisect_right
from itertools import combinations
from itertools import permutations
from bisect import bisect_left
from math import ceil
from math import radians
from heapq import heapify, heappush, heappop
import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li1():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0 and i % 2 == 1:
			s.add(i)
			n = n // i
	if n > 2 and n % 2 == 1:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def nextPowerOf2(n):
	count = 0
	if n and (not n & n - 1):
		return n
	while n != 0:
		n >>= 1
		count += 1
	return 1 << count

def cou(n):
	c = 0
	while n > 1:
		c += 1
		n //= 2
	return c

def sortsec(l):
	return sorted(l, key=lambda x: x[1])

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def subarray(A):
	r = set()
	p = {0}
	for x in A:
		p = {x | y for y in p} | {x}
		r |= p
	return len(r)
for _ in range(ii()):
	n = ii()
	a = [0] * 26
	for i in range(n):
		s = si()
		for j in s:
			a[ord(j) - 97] += 1
	for i in range(26):
		if a[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


import sys

def main():
	sys_in = sys.stdin
	sys_out = sys.stdout
	q = int(sys_in.readline())
	count = {}
	ans = 0
	for i in range(q):
		s = ''
		count.clear()
		n = int(sys_in.readline())
		ans *= 0
		for i in range(n):
			s += sys_in.readline().rstrip()
		for i in s:
			count[i] = count.get(i, 0) + 1
		for i in count:
			if count[i] % n == 0:
				ans += 1
		if ans == len(count):
			sys_out.write('YES\n')
		else:
			sys_out.write('NO\n')
main()


for i in range(int(input())):
	cases = int(input())
	Words = {}
	for i in range(cases):
		word = input()
		for j in word:
			if Words.get(j, 0) == 0:
				Words[j] = 1
			else:
				Words[j] += 1
	for i in Words:
		if Words[i] % cases != 0:
			print('NO')
			break
	else:
		print('YES')


n = int(input())
for x in range(n):
	n1 = int(input())
	l = []
	for y in range(n1):
		p = list(input().strip())
		l += p
	k = set(l)
	for z in k:
		if l.count(z) % n1 != 0:
			print('NO')
			break
	else:
		print('YES')
	l = []


for _ in range(int(input())):
	n = int(input())
	letters = [0] * 26
	for _ in range(n):
		for ch in input():
			letters[ord(ch) - ord('a')] += 1
	print('YES' if all((v % n == 0 for v in letters)) else 'NO')


import collections
for _ in range(int(input())):
	n = int(input())
	a = ''
	flag = 0
	for __ in range(n):
		a += input()
	b = collections.Counter(a).values()
	for i in b:
		if i % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	d = defaultdict(int)
	for i in range(n):
		s = input()
		n1 = len(s)
		for j in range(n1):
			d[s[j]] += 1
	for i in d:
		if d[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for x in s:
			if x in d:
				d[x] += 1
			else:
				d[x] = 1
	f = 0
	for x in d:
		if d[x] % n != 0:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	ans = 'YES'
	for k in 'abcdefghijklmnopqrstuvwxyz':
		ct = s.count(k)
		if ct % n != 0:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for x in range(t):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for c in s:
			if c in d:
				d[c] += 1
			else:
				d[c] = 1
	valid = True
	for key in d:
		if d[key] % n != 0:
			valid = False
			break
	print('YES' if valid else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	tab = [0] * 26
	for j in range(n):
		s = input()
		for a in s:
			tab[ord(a) - ord('a')] += 1
	good = 1
	for c in tab:
		if c % n:
			good = 0
	if good:
		print('YES')
	else:
		print('NO')


import random

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
for _ in range(int(input())):
	n = int(input())
	d = []
	cnt = {}
	f = 0
	for i in range(n):
		d.append(input())
		for j in d[i]:
			if j in cnt:
				cnt[j] += 1
			else:
				cnt[j] = 1
	for i in cnt.values():
		if i % n != 0:
			f = 1
	if f:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	a = int(input())
	d = ''
	for k in range(a):
		ele = input()
		d = d + ele
	r = list(d)
	t = set(r)
	o = 0
	for l in t:
		if r.count(l) >= a and r.count(l) % a == 0:
			o += 1
		else:
			o = 0
			break
	if o == 0:
		print('NO')
	else:
		print('YES')


import math

def main():
	n = int(input())
	dct = dict()
	for i in range(n):
		s = input()
		for k in s:
			if k in dct:
				dct[k] += 1
			else:
				dct[k] = 1
	for i in dct:
		if dct[i] % n != 0:
			print('NO')
			return
	print('YES')

def __starting_point():
	t = int(input())
	for i in range(t):
		main()
__starting_point()


for _ in range(int(input())):
	n = int(input())
	m = ''
	for i in range(n):
		m += input()
	l = [0 for i in range(26)]
	for i in range(len(m)):
		l[ord(m[i]) - 97] += 1
	f = True
	for i in range(26):
		if l[i] % n != 0:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


from collections import defaultdict

def canEqual(n, strings):
	countdict = defaultdict(int)
	for s in strings:
		for i in range(len(s)):
			countdict[s[i]] += 1
	for char in countdict:
		if countdict[char] % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	s = []
	for j in range(n):
		s.append(input())
	print(canEqual(n, s))


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_right(a, x)
	if i != len(a):
		return i
	else:
		return -1

def find_gt1(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		d = {}
		l = []
		for x in range(n):
			temp = list(input())
			l.append(temp)
			for j in temp:
				if d.get(j, -1) != -1:
					d[j] += 1
				else:
					d[j] = 1
		flag = 0
		for x in d.keys():
			if d[x] % n != 0:
				flag = 1
				break
		if flag:
			no()
		else:
			yes()
	except:
		pass
M = 998244353
P = 1000000007
Inf = 1000000000000000000
for _ in range(I()):
	main()


import sys
cases = True

def c2(n):
	return n * (n - 1) // 2

def get():
	return list(map(int, input().split()))

def bits(n: int):
	return list(bin(n)).count('1')

def main(test_case=False):
	n = int(input()) if test_case else 1
	for _ in range(n):
		test()

def flush():
	sys.stdout.flush()

def parr(arr):
	print(*arr, sep=' ')

def gcd(a, b):
	while b:
		if b % a == 0:
			break
		tmp = a
		a = b % a
		b = tmp
	return a

def test():
	n = int(input())
	s = [0] * 26
	for i in range(n):
		t = list(input())
		for c in t:
			s[ord(c) - ord('a')] += 1
	for i in range(26):
		if s[i] % n != 0:
			print('NO')
			return
	print('YES')
main(cases)


t = int(input())
for T in range(t):
	n = int(input())
	tr = True
	dic = {}
	sts = set()
	st = ''
	for n in range(n):
		st = st + input()
	for char in st:
		sts.add(char)
	for char in sts:
		if st.count(char) % (n + 1) != 0:
			tr = False
			break
	if tr:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = ''
	for i in range(n):
		b = input()
		a += b
	all_freq = {}
	for i in a:
		if i in all_freq:
			all_freq[i] += 1
		else:
			all_freq[i] = 1
	c = False
	for x in all_freq.values():
		if x % n != 0:
			c = True
			print('NO')
			break
	if not c:
		print('YES')


T = int(input())
for _ in range(T):
	n = int(input())
	A = []
	F = [0] * 256
	for i in range(n):
		S = str(input())
		for j in S:
			F[ord(j) - 48] += 1
	mv = max(F)
	t = 0
	for i in range(256):
		if F[i] % n != 0:
			print('NO')
			t = 1
			break
	if t == 0:
		print('YES')


n = int(input())
for i in range(n):
	t = int(input())
	d = {}
	for j in range(t):
		s = str(input())
		for k in range(len(s)):
			if s[k] not in d:
				d[s[k]] = 1
			else:
				d[s[k]] = d[s[k]] + 1
	flag = 0
	for j in d:
		if d[j] % t == 0:
			pass
		else:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


mod = 10 ** 9 + 7

def solve():
	n = int(input())
	cnt = [0 for i in range(26)]
	ok = True
	for i in range(n):
		s = input()
		for c in s:
			cnt[ord(c) - ord('a')] += 1
	for i in range(26):
		if cnt[i] % n > 0:
			ok = False
	print('YES' if ok else 'NO')
t = int(input())
while t > 0:
	solve()
	t -= 1


t = int(input())
while t != 0:
	v = True
	arr = [0] * 26
	n = int(input())
	string = ''
	for i in range(n):
		string += input()
	for i in range(len(string)):
		arr[ord(string[i]) - ord('a')] += 1
	for i in range(26):
		if arr[i] != 0:
			if arr[i] % n != 0:
				v = False
				break
	arr.clear()
	if v:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	for _ in range(n):
		s = input()
		for k in s:
			if k in d.keys():
				d[k] += 1
			else:
				d[k] = 1
	for val in d.values():
		if val >= n and val % n == 0:
			flag = 0
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


n = int(input())
chars = 'abcdefghijklmnopqrstuvwxyz'
for testcase_num in range(n):
	m = int(input())
	_count = {}
	for ch in chars:
		_count[ch] = 0
	for j in range(m):
		string = input()
		for ch in string:
			_count[ch] += 1
	ans = 'YES'
	for ch in chars:
		if not _count[ch] % m == 0:
			ans = 'NO'
	print(ans)


for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for p in s:
			if p in d.keys():
				d[p] += 1
			else:
				d1 = {p: 1}
				d.update(d1)
	f = False
	for k in d.values():
		if k % n != 0:
			f = True
			print('NO')
			break
	if f == False:
		print('YES')


t = int(input())
ans = []
for i in range(t):
	s = ''
	c = []
	k = 1
	kn = 0
	n = int(input())
	for i in range(n):
		s += input()
	for i in s:
		c.append(i)
	c.sort()
	while kn != len(c):
		i = 0
		while i + kn != len(c) - 1 and c[i + kn] == c[i + kn + 1]:
			k += 1
			i += 1
		if k % n != 0 and k != 0:
			ans.append('NO')
			kn = 0
			break
		else:
			kn += k
			k = 1
	if kn != 0:
		ans.append('YES')
print(*ans, sep='\n')


import sys
input = sys.stdin.readline
N = int(input())
for _ in range(N):
	d = {}
	ans = 0
	M = int(input())
	for _ in range(M):
		string = input()
		for s in string:
			if s not in d.keys():
				d[s] = 1
			else:
				d[s] += 1
	for v in d.values():
		if v % M != 0:
			ans += 1
	if ans != 0:
		print('NO')
	else:
		print('YES')


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import Counter
for _ in range(ii()):
	n = ii()
	r = ''
	for i in range(n):
		a = si()
		r = r + a
	cn = Counter(r)
	p = 0
	for c in cn:
		if cn[c] % n != 0:
			print('NO')
			p = p + 1
			break
	if p == 0:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	new = {}
	for k in range(n):
		s = input()
		for i in s:
			if i in new:
				new[i] += 1
			else:
				new[i] = 1
	for j in new.values():
		if j % n != 0:
			print('NO')
			break
	else:
		print('YES')


for t in range(int(input())):
	n = int(input())
	count = [0] * 26
	for i in range(n):
		s = input()
		for item in s:
			count[ord(item) - ord('a')] += 1
	print('YES' if all((t % n == 0 for t in count)) else 'NO')


t = int(input())
while t > 0:
	n = int(input())
	d = {}
	q = n
	while n > 0:
		s = str(input())
		for i in range(0, len(s)):
			if s[i] not in d.keys():
				d[s[i]] = 1
			else:
				d[s[i]] += 1
		n -= 1
	flag = 0
	for j in d.keys():
		if d[j] % q != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [0] * 26
	for i in range(n):
		s = input()
		for j in s:
			arr[ord(j) - 97] += 1
	flag = 0
	for i in arr:
		if i % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


test = int(input())
for t in range(test):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	flag = True
	for i in d:
		if d[i] % n == 0:
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	fre = {}
	c = ''
	for i in range(n):
		s = input()
		c += s
	for j in c:
		if j in fre:
			fre[j] += 1
		else:
			fre[j] = 1
	for i in fre.keys():
		if fre[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


import sys

def input():
	return sys.stdin.readline().rstrip()

def input_split():
	return [int(i) for i in input().split()]
testCases = int(input())
answers = []
for _ in range(testCases):
	n = int(input())
	strs = []
	for i in range(n):
		strs.append(input())
	freqs = {}
	for s in strs:
		for c in s:
			if c in freqs:
				freqs[c] += 1
			else:
				freqs[c] = 1
	ans = 'YES'
	for k in freqs:
		if freqs[k] % n != 0:
			ans = 'NO'
			break
	answers.append(ans)
print(*answers, sep='\n')


t = int(input())
for i in range(t):
	n = int(input())
	a = ''
	cnt = 0
	for j in range(n):
		x = input()
		a += x
	a = sorted(a)
	b = list(set(a))
	for j in range(len(b)):
		if a.count(b[j]) % n == 0:
			cnt += 1
	if cnt == len(b):
		print('YES')
	else:
		print('NO')


def check(n, d):
	for i in d:
		if d[i] % n != 0:
			return False
	return True
for t in range(int(input())):
	n = int(input())
	a = [input() for i in range(n)]
	d = {}
	for s in a:
		for c in s:
			if c not in d:
				d[c] = 1
			else:
				d[c] += 1
	print('YES' if check(n, d) else 'NO')


from collections import Counter
t = int(input())
while t:
	c = Counter()
	t -= 1
	n = int(input())
	p = n
	while n:
		n -= 1
		s = input()
		for i in s:
			c.update(i)
	cl = dict(c)
	f = 0
	for (key, val) in cl.items():
		if val % p != 0:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	dic = {}
	ans = 0
	for i in range(n):
		s = input()
		for j in s:
			if j in dic:
				dic[j] += 1
			else:
				dic[j] = 1
	for i in dic:
		if dic[i] % n != 0:
			ans = 1
			break
	print('YES' if ans == 0 else 'NO')


from collections import defaultdict
T = int(input())
for _ in range(T):
	N = int(input())
	freq = defaultdict(int)
	for _ in range(N):
		Str = input()
		for s in Str:
			freq[s] += 1
	flag = 1
	for cnt in freq.values():
		if cnt % N != 0:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = []
	for i in range(n):
		s = input()
		l.append(s)
	d = {}
	for i in l:
		for j in i:
			if j not in d:
				d[j] = 1
			else:
				d[j] += 1
	aa = []
	for v in d.values():
		if v % n != 0:
			aa.append('NO')
		else:
			aa.append('YES')
	if 'NO' in aa:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	d = []
	w = ''
	for j in range(n):
		s = input()
		w += s
	for k in w:
		if k not in d:
			o = w.count(k)
			if o % n != 0:
				print('NO')
				break
			d.append(k)
	else:
		print('YES')


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
sys.setrecursionlimit(10 ** 5)

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def solve():
	n = II()
	str1 = []
	str2 = []
	count = 0
	for __ in range(n):
		str1 += list(input())
	[str2.append(x) for x in str1 if x not in str2]
	for ___ in range(len(str2)):
		if str1.count(str2[___]) % n == 0:
			count += 1
	if count == len(str2):
		print('YES')
	else:
		print('NO')
for _ in range(II()):
	solve()


t = int(input())
for x in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	check = True
	for i in s:
		if s.count(i) % n != 0:
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	d = {}
	for ___ in range(n):
		for sym in input():
			if sym not in d:
				d[sym] = 1
			else:
				d[sym] += 1
	flag = 0
	for k in d:
		if d[k] % n == 0:
			pass
		else:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


from collections import defaultdict
t = int(input())
while t:
	t -= 1
	n = int(input())
	dic = defaultdict(int)
	for i in range(n):
		s = input()
		for j in s:
			dic[j] += 1
	flag = 0
	for val in dic.values():
		if val % n != 0:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	b = ''
	for i in list(set(s)):
		if s.count(i) % n == 0:
			b = 'YES'
		else:
			b = 'NO'
			break
	print(b)


t = int(input())
for i in range(t):
	n = int(input())
	hello = []
	for i in range(n):
		hello.append(input())
	dic = {}
	for word in hello:
		for j in word:
			dic[j] = 0
	for word in hello:
		for j in word:
			dic[j] += 1
	possible = True
	for i in dic:
		if dic[i] % n != 0:
			print('NO')
			possible = False
			break
	if possible:
		print('YES')


from collections import Counter
a = int(input())
for i in range(a):
	n = int(input())
	ls = []
	for j in range(n):
		a = input()
		ls.append(a)
	ms = []
	ms = ''.join(ls)
	s = set(ms)
	cnt = 0
	for i in Counter(ms).values():
		if i % n == 0:
			cnt += 1
	if cnt == len(s):
		print('YES')
	else:
		print('NO')


import sys
sys.setrecursionlimit(1000000)

def Ints():
	return map(int, sys.stdin.readline().strip().split())

def Strs():
	return map(str, sys.stdin.readline().strip().split())

def Array():
	return list(map(int, sys.stdin.readline().strip().split()))

def Str():
	return sys.stdin.readline().strip()

def Int():
	return int(sys.stdin.readline().strip())

def MOD():
	return 1000000007

def power(base, power):
	MOD = 1000000007
	result = 1
	while power > 0:
		if power % 2 == 1:
			result = result * base % MOD
		power = power // 2
		base = base * base % MOD
	return result
t = Int()
while t:
	N = Int()
	check = N
	maps = {}
	while N:
		N -= 1
		S = Str()
		for i in S:
			maps[i] = maps.get(i, 0) + 1
	if N % 2 == 0:
		flag = False
		for i in maps:
			if maps[i] % check != 0 or maps[i] < check:
				flag = True
				break
		if flag:
			print('NO')
		else:
			print('YES')
	else:
		flag = False
		for i in maps:
			if maps[i] % check != 1 or maps[i] < check:
				flag = True
				break
		if flag:
			print('NO')
		else:
			print('YES')
	t -= 1


t = int(input())
abc = [chr(i) for i in range(97, 97 + 26)]
for _ in range(t):
	n = int(input())
	cnt = [0] * 26
	for i in range(n):
		c = input()
		for j in range(len(c)):
			cnt[abc.index(c[j])] += 1
	flg = 0
	for i in range(26):
		if cnt[i] % n != 0:
			flg = 1
			break
	if flg:
		print('NO')
	else:
		print('YES')


temp = ord('a')
for _ in range(int(input())):
	n = int(input())
	B = [0] * 26
	for i in range(n):
		s = str(input())
		for x in s:
			B[ord(x) - temp] += 1
	flag = 1
	for z in B:
		if z % n != 0:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


I = input
exec(int(I()) * "n=int(I());exec('s='+('+I()'*n)[1:]);print('YNEOS'[any(s.count(x)%n for x in s)::2]);")


for _ in range(int(input())):
	x = []
	test = int(input())
	for i in range(test):
		x.append(input())
	x = ''.join(x)
	x = list(x)
	y = list(set(x))
	ans = True
	for i in range(len(y)):
		if x.count(y[i]) % test != 0:
			ans = False
			break
	if ans == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		a = input()
		for j in a:
			try:
				d[j] += 1
			except:
				d[j] = 1
	k = 0
	for i in d.keys():
		if d[i] % n == 0:
			pass
		else:
			k = 1
			break
	if k == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	letter_count = {}
	for _ in range(n):
		line = input()
		for symbol in line:
			if symbol not in letter_count:
				letter_count[symbol] = 0
			letter_count[symbol] += 1
	flag = True
	for letter in letter_count:
		letter_amount = letter_count[letter]
		if letter_amount % n != 0:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


def solve(e, l):
	dic = {}
	for i in range(e):
		for j in range(len(l[i])):
			if l[i][j] not in dic:
				dic[l[i][j]] = 1
			else:
				dic[l[i][j]] += 1
	m = []
	m = list(dic.values())
	flag = 0
	for i in range(len(m)):
		if m[i] % e != 0:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')
n = int(input())
for i in range(n):
	l = []
	e = int(input())
	for j in range(e):
		l.append(input())
	solve(e, l)


t = int(input())
for you in range(t):
	n = int(input())
	fre = [0 for i in range(26)]
	for i in range(n):
		s = input()
		for x in s:
			fre[ord(x) - 97] += 1
	flag = 0
	for i in fre:
		if i % n != 0:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


import collections
t = int(input())
for test in range(t):
	n = int(input())
	string = ''
	for _ in range(n):
		string += input()
	c = collections.Counter(string)
	flag = True
	for (k, v) in c.items():
		if v % n != 0:
			flag = False
			break
	if flag is True:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(0, a):
	b = int(input())
	arr = []
	for i in range(b):
		s = input()
		for i in s:
			arr.append(i)
	s = set()
	for i in arr:
		s.add(i)
	d = dict()
	for i in s:
		d[i] = 0
	for i in arr:
		d[i] = d[i] + 1
	k = 0
	for i in d.keys():
		if not d[i] % b == 0:
			k = 1
			break
	if k == 0:
		print('YES')
	else:
		print('NO')


from bisect import bisect_left
import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict
from collections import deque
from functools import cmp_to_key
import math

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		n = iin()
		d = {}
		for i in range(n):
			s = sin()
			for j in s:
				if j in d:
					d[j] += 1
				else:
					d[j] = 1
		flag = 0
		for v in d.values():
			if v % n != 0:
				flag = 1
				break
		if flag:
			print('NO')
		else:
			print('YES')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
INF = float('inf')
tc = int(input())
for _ in range(tc):
	n = int(input())
	alpa = [0] * 26
	ans = 'YES'
	for _ in range(n):
		string = list(input().rstrip())
		for char in string:
			integer = ord(char) - 97
			alpa[integer] += 1
	for x in alpa:
		if x % n != 0:
			ans = 'NO'
			break
	print(ans)


t = int(input())
while t:
	t = t - 1
	n = int(input())
	a = {}
	for i in range(n):
		s = input()
		for x in s:
			if x in a:
				a[x] += 1
			else:
				a[x] = 1
	can = True
	for x in a:
		if a[x] % n != 0:
			can = False
	if can:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	n = int(input())
	d = {}
	s = ''
	for i in range(n):
		st = input()
		s = s + st
	l = list(s)
	s = set(l)
	for k in s:
		d[k] = 0
	for val in l:
		d[val] = d[val] + 1
	val_list = list(d.values())
	bool_list = [k % n == 0 for k in val_list]
	if all(bool_list):
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	d = {}
	flag = True
	for i in range(n):
		s = input()
		for elem in s:
			d[elem] = d.get(elem, 0) + 1
	for key in d:
		if d[key] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	d = dict()
	for i in range(n):
		s = input()
		for j in s:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	for i in d.values():
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	main = []
	d = {}
	for i in range(n):
		temp = input()
		for j in temp:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	for i in d:
		main.append(d[i])
	f = 0
	for i in main:
		if i % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	r = []
	m = []
	c = 0
	t = 0
	l = int(input())
	for k in range(l):
		j = list(input())
		m = m + j
	for p in set(m):
		for q in range(int(len(m))):
			if p == m[q]:
				c = c + 1
		r.append(c)
		c = 0
	for w in r:
		if w % l == 0:
			t = t + 1
	if len(r) == t:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = ''
	dic = {}
	for j in range(n):
		s += input().strip()
	for k in s:
		if k not in dic:
			dic[k] = 1
			continue
		dic[k] += 1
	tmp = 0
	for m in dic:
		if dic[m] % n == 0:
			tmp += 1
			if tmp == len(dic):
				print('YES')
			continue
		print('NO')
		break


t = int(input())

def countlet(strn, let, count):
	for i in strn:
		if i == let:
			count += 1
	return count
for i in range(t):
	n = int(input())
	arr = []
	arr1 = []
	arr2 = []
	for j in range(n):
		strn = input()
		arr.append(strn)
		for k in strn:
			if k in arr1:
				continue
			else:
				arr1.append(k)
	for l in arr1:
		count = 0
		for w in arr:
			count = int(countlet(w, l, count))
		arr2.append(count)
	game = True
	for m in arr2:
		if m % n != 0:
			game = False
			break
		else:
			continue
	print('YES' if game else 'NO')


import sys
readline = sys.stdin.readline

def i1():
	return int(readline())

def s1():
	return readline().rstrip()

def sn(n):
	return [readline().rstrip() for i in range(n)]

def sm(n):
	return (readline().rstrip() for i in range(n))

def redir(s):
	global readline
	import os
	fn = sys.argv[0] + f'/../in-{s}.txt'
	readline = open(fn).readline if os.path.exists(fn) else readline
redir('a')
_cnt0 = {i: 0 for i in 'abcdefghijklmnopqrstuvwxyz'}
for _ in range(i1()):
	n = i1()
	cnt = _cnt0.copy()
	for s in sm(n):
		for ch in s:
			cnt[ch] += 1
	for i in cnt.values():
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write('\n'.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from decimal import Decimal
INF = float('inf')
mod = int(1000000000.0) + 7
for t in range(int(data())):
	n = int(data())
	d = dd(int)
	for i in range(n):
		s = data()
		for j in s:
			d[j] += 1
	k = 1
	for i in d:
		if d[i] % n != 0:
			k = 0
			break
	if k:
		out('YES')
	else:
		out('NO')


from itertools import groupby
for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	s = list(s)
	s.sort()
	for (i, j) in groupby(s):
		if len(list(j)) % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import defaultdict
for i in range(int(input())):
	n = int(input())
	di = defaultdict(int)
	for i in range(n):
		s = str(input())
		for i in range(len(s)):
			di[s[i]] += 1
	li = di.values()
	ans = True
	for i in li:
		if i % n != 0:
			print('NO')
			ans = False
			break
	if ans == True:
		print('YES')


T = int(input())
for _ in range(0, T):
	n = int(input())
	pos = [0] * 30
	for i in range(n):
		s = input()
		for j in range(0, len(s)):
			pos[ord(s[j]) - 97] += 1
	temp = 'YES'
	for i in range(0, len(pos)):
		if pos[i] % n != 0:
			temp = 'NO'
	print(temp)


t = int(input())
import collections as c
for _ in range(t):
	n = int(input())
	a = [list(input()) for i in range(n)]
	s = c.Counter(a[0])
	for i in range(1, n):
		s += c.Counter(a[i])
	tr = 1
	for i in s:
		if s[i] % n != 0:
			tr = 0
			break
	if tr == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	collection = {}
	for j in range(n):
		word = input()
		for char in word:
			if char in collection.keys():
				collection[char] += 1
			else:
				collection[char] = 1
	possible = True
	for value in collection.values():
		if value % n != 0:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	freq = {}
	for i in range(ord('a'), ord('z') + 1):
		freq[chr(i)] = 0
	for i in range(n):
		s = input()
		for i in s:
			freq[i] += 1
	ans = 'YES'
	for i in freq:
		if freq[i] % n:
			ans = 'NO'
	print(ans)


from collections import deque
n = int(input())
for _ in range(n):
	l = int(input())
	counter = {}
	s = []
	for j in range(l):
		s.append(input())
	for i in range(len(s)):
		for j in range(len(s[i])):
			try:
				counter[s[i][j]] += 1
			except KeyError:
				counter[s[i][j]] = 1
	val = 0
	for i in counter:
		if counter[i] % l != 0:
			val += 1
			break
	if not val:
		print('YES')
	else:
		print('NO')


for iii in range(int(input())):
	n = int(input())
	l = []
	m = ''
	for i in range(n):
		l.append(input())
		m = m + l[i]
	m = list(m)
	d = {}
	for i in range(len(m)):
		try:
			d[m[i]] += 1
		except KeyError:
			d[m[i]] = 1
	f = list(d.values())
	ans = 'YES'
	for i in range(len(f)):
		if f[i] % n != 0:
			ans = 'NO'
	print(ans)


for i in range(int(input())):
	n = int(input())
	a = [0] * 26
	for i in range(n):
		s = list(input())
		for c in s:
			a[ord(c) - ord('a')] += 1
	poss = True
	for i in a:
		if i % n:
			poss = False
	if poss:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	char_dic = {}
	for i in range(n):
		string = input()
		for char in string:
			if char in char_dic:
				char_dic[char] += 1
			else:
				char_dic[char] = 1
	ans = 'YES'
	for (key, value) in char_dic.items():
		if value % n:
			ans = 'NO'
			break
	print(ans)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	string = ''
	for _ in range(n):
		string += input()
	from collections import Counter
	flag = 0
	store = Counter(string)
	for (a, b) in store.items():
		if b % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for i in s:
			d[i] = d.get(i, 0) + 1
	for i in list(d.values()):
		if i % n:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
from collections import Counter
for test in range(t):
	n = int(input())
	c = Counter()
	for i in range(n):
		s = input()
		for x in s.strip():
			c[x] += 1
	print('YES' if all((x % n == 0 for x in c.values())) else 'NO')


for _ in range(int(input())):
	n = int(input())
	d = dict()
	for i in range(n):
		for i in input():
			d[i] = d.get(i, 0) + 1
	s = 0
	for (i, j) in list(d.items()):
		if d[i] % n != 0:
			s += 1
			break
	if s == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for q in range(t):
	num = int(input())
	st = list()
	for n in range(num):
		s = list(input())
		st.append(s)
	chr_ = {}
	for ls in st:
		for i in ls:
			if i not in chr_.keys():
				chr_[i] = 1
			else:
				chr_[i] += 1
	ans = 'YES'
	for val in chr_.values():
		if val % num != 0:
			ans = 'NO'
			break
	print(ans)


from collections import Counter
T = int(input())
for _ in range(T):
	n = int(input())
	s = ''
	for _ in range(n):
		a = input().strip()
		s += a
	c = Counter(s)
	check = 0
	for val in c.values():
		if val % n != 0:
			check = 1
			break
	if check == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	c = Counter()
	for i in range(n):
		c += Counter(input())
	check = 0
	for v in c:
		if c[v] % n != 0:
			check = 1
			print('NO')
			break
	if not check:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = [input() for _ in range(n)]
	cnt = [0] * 26
	for i in s:
		for j in i:
			cnt[ord(j) - ord('a')] += 1
	ok = True
	for i in cnt:
		ok &= not i % n
	print('YES' if ok else 'NO')


T = int(input())
for __ in range(T):
	N = int(input())
	dicti = dict()
	for _ in range(N):
		S = input()
		for each in S:
			if each not in dicti:
				dicti[each] = 0
			dicti[each] += 1
	flag = 0
	lent = len(dicti)
	for x in dicti.values():
		if x % N == 0:
			flag += 1
	if lent == flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = []
	l2 = [0] * 26
	for i in range(n):
		l1.append(input())
	for i in range(n):
		for j in range(len(l1[i])):
			l2[ord(l1[i][j]) - ord('a')] += 1
	f = 0
	for i in range(26):
		if l2[i] % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


from collections import defaultdict as d
t = int(input())
for _ in range(t):
	n = int(input())
	letterCnts = d(lambda : 0)
	for __ in range(n):
		s = input()
		for c in s:
			letterCnts[c] += 1
	ok = True
	for v in letterCnts.values():
		if v % n != 0:
			ok = False
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for m in range(t):
	n = int(input())
	A = []
	string = ''
	for i in range(n):
		x = input()
		A.append(x)
		string += x
		y = True
	for i in range(len(string)):
		a = string.count(string[i])
		if a % n != 0:
			y = False
			print('NO')
			break
	if y == True:
		print('YES')


t = int(input())
while t > 0:
	n1 = int(input())
	n = []
	for x in range(n1):
		s = input()
		A = [0 for x in range(26)]
		for i in s:
			n.append(i)
	f = 1
	for i in n:
		A[ord(i) - ord('a')] += 1
	for j in A:
		if j % n1 != 0:
			f = 0
			break
		else:
			f = 1
	if f == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	s = ''
	for j in range(n):
		s += input()
	ans = 'YES'
	for j in s:
		if s.count(j) % n != 0:
			ans = 'NO'
	print(ans)


n = int(input())
while n:
	list1 = []
	num = int(input())
	for i in range(num):
		q = input()
		m = list(q)
		list1.extend(m)
	d = {i: list1.count(i) for i in list1}
	count1 = 0
	for j in d.values():
		if j % num == 0:
			count1 += 1
	if count1 == len(d):
		print('YES')
	else:
		print('NO')
	n -= 1


def jugglingLetters(N: int, characters: str) -> bool:
	counts = {}
	for char in characters:
		if char in counts:
			counts[char] += 1
		else:
			counts[char] = 1
	for val in counts.values():
		if val % N != 0:
			return 'NO'
	return 'YES'
test_cases = int(input())
for _ in range(test_cases):
	N = int(input())
	characters = []
	for i in range(N):
		characters += input()
	print(jugglingLetters(N, characters))


from collections import defaultdict
t = int(input())
while t != 0:
	d = defaultdict(int)
	n = int(input())
	for i in range(n):
		s = input()
		for j in range(len(s)):
			d[s[j]] += 1
	f = 0
	for i in d.keys():
		if d[i] % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


from sys import stdin, stdout
input = stdin.readline
from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	s = []
	for _ in range(n):
		s.append(input().strip())
	let = defaultdict(int)
	for si in s:
		for i in si:
			let[i] += 1
	for (i, j) in let.items():
		if j % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = []
	for _ in range(n):
		a.append(input())
	freq = defaultdict(int)
	for i in a:
		for j in i:
			freq[j] += 1
	flag = True
	for k in freq:
		if freq[k] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = [input() for i in range(n)]
	alphabets = dict()
	for string in s:
		for char in string:
			if ord(char) not in alphabets.keys():
				alphabets[ord(char)] = 1
			else:
				alphabets[ord(char)] += 1
	flag = True
	for count in alphabets.values():
		if count % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	for i in range(n):
		string = list(input())
		for j in string:
			arr.append(j)
	new = set(arr)
	for i in new:
		if arr.count(i) % n == 0:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
import threading, sys
from threading import Thread, main_thread

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(10240000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def main():
	for _ in range(ii()):
		n = ii()
		s = []
		for i in range(n):
			s.append(si())
		f = [0] * 26
		for i in range(n):
			for j in range(len(s[i])):
				f[abd[s[i][j]]] += 1
		flag = 1
		for i in range(26):
			if f[i] % n != 0:
				flag = 0
				break
		if flag:
			print('YES')
		else:
			print('NO')
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	n = int(input())
	a = [0] * 26
	for i in range(n):
		s = input()
		for i in s:
			a[ord(i) - 97] += 1
	pos = True
	for i in a:
		if i % n:
			pos = False
			break
	print('YES' if pos else 'NO')


import itertools
import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlst():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s) - 1])

def invar():
	return map(int, input().split())

def pba(n, s):
	k = list(''.join(s))
	d = {}
	for i in k:
		if i not in d:
			d[i] = 0
		d[i] += 1
	for i in d.values():
		if i % n != 0:
			return 'NO'
	return 'YES'
for _ in range(inp()):
	n = inp()
	s = []
	for i in range(n):
		temp = str(input())
		s.append(temp[:len(temp) - 1])
	print(pba(n, s))


t = int(input())
for i in range(t):
	n = int(input())
	b = [0] * 26
	for j in range(n):
		s = input()
		for k in s:
			b[ord(k) - 97] += 1
	f = 0
	for j in b:
		if j % n != 0:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	dict = {}
	for j in range(n):
		string = input()
		for k in string:
			if k not in dict:
				dict[k] = 1
			else:
				dict[k] += 1
	yes = True
	for j in dict:
		if dict[j] % n != 0:
			print('NO')
			yes = False
			break
	if yes:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	str1 = ''
	for i in range(n):
		str = input()
		str = str1 + str
		str1 = str
		d = {}
	for i in str1:
		k = d.keys()
		if i in k:
			d[i] += 1
		else:
			d[i] = 1
	x = 'YES'
	for j in d.values():
		if j % n != 0:
			x = 'NO'
	print(x)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		s = input()
		for j in s:
			l.append(j)
	count = Counter(l)
	flag = True
	for i in count:
		if count[i] % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


import sys
import math, bisect
from collections import defaultdict
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, OrderedDict

def neo():
	return map(int, input().split())

def Neo():
	return list(map(int, input().split()))
for _ in range(int(input())):
	N = int(input())
	S = ''
	for i in range(N):
		s = input()
		S += s
	Z = Counter(S)
	f = 0
	for i in Z.values():
		if i % N != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	s = ''
	n = int(input())
	for i in range(n):
		string = input()
		s += string
	if len(s) % n != 0:
		print('NO')
		continue
	a = list(s)
	f = 1
	for i in set(a):
		if a.count(i) % n != 0:
			f = 0
			print('NO')
			break
	if f == 1:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	q = ''
	for i in range(n):
		q += input()
	ans = 'YES'
	for i in set(q):
		if q.count(i) % n:
			ans = 'NO'
			break
	print(ans)


import io
import os
import sys
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def printd(*args, **kwargs):
	print(*args, **kwargs)
	pass

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
t = oint()
for _ in range(t):
	n = oint()
	s = []
	for i in range(n):
		s += list(get_str())
	ss = set(s)
	cnt = []
	for c in ss:
		if s.count(c) % n:
			print('NO')
			break
	else:
		print('YES')


MOD = 1000000007
from collections import defaultdict as dd, Counter, deque

def si():
	return input()

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())

def out(v):
	print(v)

def spout():
	print(v, end=' ')

def d2b(n):
	return bin(n).replace('0b', '')

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ispow2(x):
	return x and (not x & x - 1)

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)
t = ii()
while t:
	t -= 1
	n = ii()
	d = {}
	a = let()
	f = 0
	m = n
	for i in a:
		d[i] = 0
	while n:
		n -= 1
		s = si()
		for i in s:
			d[i] += 1
	for i in d.keys():
		if d[i] % m != 0:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')


for _ in range(int(input())):
	x = int(input())
	li1 = [0] * 26
	for i in range(x):
		li = list(input())
		for i in li:
			li1[ord(i) - 97] += 1
	for i in li1:
		if i % x != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
t = int(input())
for tests in range(t):
	n = int(input())
	C = Counter()
	for i in range(n):
		S = input().strip()
		for s in S:
			C[s] += 1
	for c in C.values():
		if c % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
for t in range(int(input())):
	n = int(input())
	l = [input() for i in range(n)]
	s = ''.join(l)
	d = Counter(s)
	f = 0
	for e in d.values():
		if e % n != 0:
			f = 1
			break
	print('YNEOS'[f::2])


from collections import Counter
t = int(input())
for j in range(t):
	n = int(input())
	s = input()
	for i in range(n - 1):
		p = input()
		s += p
	d = Counter(s)
	c = 0
	for i in d.values():
		if i % n == 0:
			c += 1
			pass
		else:
			print('NO')
			break
	if c == len(d):
		print('YES')


from collections import Counter
for _ in range(int(input())):
	f = 0
	n = int(input())
	string = ''
	for _ in range(n):
		string += input()
	c = Counter(string)
	for value in c.values():
		if value % n:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	st = ''
	for _ in range(n):
		st += str(input())
	c = 0
	for i in set(st):
		if st.count(i) % n != 0:
			c += 1
	if c == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	dic = {}
	for i in range(n):
		s = input()
		for j in s:
			try:
				dic[j] += 1
			except:
				dic[j] = 1
	b = 'YES'
	for i in dic:
		if dic[i] % n != 0:
			b = 'NO'
			break
	print(b)


for _ in range(int(input())):
	n = int(input())
	strs = {}
	for i in range(n):
		s = input()
		for j in s:
			if j not in strs:
				strs[j] = 1
			else:
				strs[j] += 1
	lis = list(strs.values())
	flag = 1
	for i in lis:
		if i % n != 0:
			flag = 0
			break
	print('YES') if flag else print('NO')


for _ in range(int(input())):
	n = int(input())
	d = dict()
	for i in range(n):
		s = input()
		for i in s:
			try:
				d[i] += 1
			except:
				d[i] = 1
	z = 0
	for i in d:
		if d[i] % n != 0:
			z = 1
			break
	if z == 1:
		print('NO')
	else:
		print('YES')


testcases = int(input())
for testcase in range(testcases):
	n = int(input())
	dicts = {}
	for i in range(n):
		strs = input()
		for j in strs:
			if j not in dicts:
				dicts[j] = 1
			else:
				dicts[j] += 1
	flag = 0
	for (key, value) in dicts.items():
		if value % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	s = ''
	for j in range(n):
		s1 = input()
		s += s1
	s = list(s)
	dict1 = {}.fromkeys(s, 0)
	for key in s:
		dict1[key] += 1
	f = 0
	for key in dict1:
		if dict1[key] % n != 0:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


t = int(input())
for _ in range(t):
	K = [0] * 26
	n = int(input())
	for _ in range(n):
		S = input()
		for s in S:
			K[ord(s) - ord('a')] += 1
	flag = 1
	for k in K:
		if k % n != 0:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


import sys, bisect
from sys import stdin, stdout
from bisect import bisect_left, bisect_right, bisect, insort, insort_left, insort_right
from math import gcd, ceil, floor, sqrt
from collections import Counter, defaultdict, deque, OrderedDict
from queue import Queue, PriorityQueue
from string import ascii_lowercase
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 998244353
mod = 10 ** 9 + 7

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, ceil(sqrt(n)) + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def DFS(dictionary, vertex, visited):
	visited[vertex] = True
	stack = [vertex]
	print(vertex)
	while stack:
		a = stack.pop()
		for i in dictionary[a]:
			if not visited[i]:
				print(i)
				visited[i] = True
				stack.append(i)

def BFS(dictionary, vertex, visited):
	visited[vertex] = True
	q = deque()
	q.append(vertex)
	while q:
		a = q.popleft()
		for i in dictionary[a]:
			if not visited[i]:
				visited[i] = True
				q.append(i)
				print(i)

def soe(limit):
	l = [1] * (limit + 1)
	l[0] = 0
	l[1] = 0
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	d = {}
	n = inp()
	for i in range(n):
		s = input()
		for i in s:
			d[i] = d.get(i, 0) + 1
	for i in d:
		if d[i] % n != 0:
			pr('NO')
			return
	pr('YES')
for _ in range(inp()):
	solve()


from math import log2, ceil
from heapq import heappush, heappop, heapify
from copy import deepcopy
from collections import deque, Counter as CC

def main():
	for t in range(int(input())):
		n = int(input())
		d = dict()
		for i in range(n):
			s = input()
			for j in s:
				if j in d:
					d[j] += 1
				else:
					d[j] = 1
		for k in d:
			if d[k] % n != 0:
				print('NO')
				break
		else:
			print('YES')
main()


import collections
for t in range(int(input())):
	n = int(input())
	k = collections.defaultdict(int)
	for i in range(n):
		for j in input():
			k[j] += 1
	ans = True
	for i in k:
		if k[i] % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	d = dict()
	for j in range(n):
		s = input()
		for k in s:
			d[k] = d.get(k, 0) + 1
	flag = True
	for j in list(d.values()):
		if j % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


t = int(input())
d = {}
for i in range(t):
	n = int(input())
	for j in range(n):
		for el in input():
			d[el] = d.get(el, 0) + 1
	f = True
	for key in d:
		if d[key] % n != 0:
			print('NO')
			f = False
			break
	if f:
		print('YES')
	d = {}


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))
ans = []
t = ini()
for _ in range(t):
	n = ini()
	count = {}
	for _ in range(n):
		s = ins()
		for i in s:
			if i not in count:
				count[i] = 0
			count[i] += 1
	tmp = True
	for (i, j) in count.items():
		if j % n != 0:
			tmp = False
			break
	ans.append('YES' if tmp else 'NO')
out(ans)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	s = Counter(s)
	for x in s:
		if s[x] % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	f = ''
	for i in range(n):
		s = input()
		f += s
	d = {}
	for i in f:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	ans = 'YES'
	for i in d:
		if d[i] % n == 0:
			continue
		else:
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	c = 0
	fg = 1
	li = [list(input()) for _ in range(n)]
	lis = set()
	for i in range(n):
		for j in li[i]:
			lis.add(j)
	licnt = list()
	for k in lis:
		m = 0
		for d in range(n):
			m += li[d].count(k)
		licnt.append(m)
	for m in licnt:
		if m % n != 0:
			fg = 0
			break
	if fg == 0:
		print('NO')
	else:
		print('YES')


from math import *
from collections import *
from random import *
from decimal import Decimal
from heapq import *
from bisect import *
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 5)

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())

def inp():
	return int(input())

def st1():
	return input().rstrip('\n')
t = inp()
while t:
	t -= 1
	n = inp()
	co = [0] * 26
	for i in range(n):
		s = st1()
		for j in s:
			co[ord(j) - 97] += 1
	fl = 0
	for i in range(26):
		if co[i] % n == 0:
			continue
		fl = 1
	s = 'YES'
	if fl:
		s = 'NO'
	print(s)


import os
import heapq
import sys, threading
import math
import bisect
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		dic = defaultdict(int)
		for i in range(n):
			st = input()
			for j in range(len(st)):
				dic[st[j]] += 1
		c = 0
		for (key, item) in dic.items():
			if item % n == 0:
				continue
			else:
				c = 1
				break
		if c:
			print('NO')
		else:
			print('YES')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	st = ''
	for _ in range(n):
		s = input()
		st = st + s
	dict = {}
	for i in st:
		if i not in dict:
			dict[i] = 1
		else:
			dict[i] += 1
	f = False
	for i in dict:
		if dict[i] // n == dict[i] / n:
			pass
		else:
			f = True
			break
	if f:
		print('NO')
	else:
		print('YES')


n = int(input())
for _ in range(n):
	num = int(input())
	string = ''
	for _ in range(num):
		a = input()
		string = string + a
	all_freq = {}
	for i in string:
		if i in all_freq:
			all_freq[i] += 1
		else:
			all_freq[i] = 1
	freq = list(all_freq.values())
	flag = 'YES'
	for a in freq:
		if a % num != 0:
			flag = 'NO'
			break
	print(flag)


def elem(st):
	l = []
	for i in range(len(st)):
		l.append(st[i:i + 1])
	return l
for t in range(int(input())):
	flg = 0
	n = int(input())
	lst = []
	for i in range(n):
		s = elem(input())
		lst += s
	s = set(lst)
	for i in s:
		flg += 1 if lst.count(i) % n != 0 else 0
	print('YES' if flg == 0 else 'NO')


q = int(input())
while q > 0:
	q -= 1
	n = int(input())
	ar = dict()
	for i in range(n):
		s = str(input())
		for j in range(len(s)):
			if s[j] not in ar:
				ar[s[j]] = 0
			ar[s[j]] += 1
	ok = 1
	for i in ar.items():
		ok &= i[1] % n == 0
	if ok:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	chars = defaultdict(int)
	for i in range(n):
		s = [i for i in input().strip()]
		for j in s:
			chars[j] += 1
	ok = True
	for (k, v) in chars.items():
		if v % n:
			ok = False
	print('YES' if ok else 'NO')


t = int(input())
n = []
lis = []
out = []
for i in range(t):
	lis.append([])
	n.append(int(input()))
	s = ''
	for j in range(n[i]):
		lis[i].append(input())
		s += lis[i][j]
	flag = True
	for k in list(map(chr, range(97, 123))):
		if s.count(k) % n[i] != 0:
			flag = False
			break
	if flag:
		out.append('YES')
	else:
		out.append('NO')
for i in out:
	print(i)


t = int(input())
r = []
for _ in range(t):
	n = int(input())
	p = []
	count = 0
	for x in range(n):
		s = input()
		s = list(s)
		for x in s:
			p.append(x)
	a = list(set(p))
	for x in a:
		if p.count(x) % n == 0:
			pass
		else:
			count += 1
	if count > 0:
		r.append('NO')
	else:
		r.append('YES')
for x in r:
	print(x)


for _ in range(int(input())):
	n = int(input())
	L = []
	for i in range(n):
		L.append(input())
	d = {}
	for i in L:
		for j in i:
			if j not in d:
				d[j] = 1
			else:
				d[j] += 1
	f = 0
	for i in d:
		if d[i] % n != 0:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


def juggle(n, a):
	ref = {}
	for i in a:
		if i in ref:
			ref[i] += 1
		else:
			ref[i] = 1
	for i in a:
		if ref[i] % n != 0:
			return 'NO'
	return 'YES'
n = int(input())
res = []
for i in range(n):
	p = int(input())
	q = ''
	for i in range(p):
		q += str(input())
	res.append(juggle(p, q))
for j in res:
	print(j)


for _ in range(int(input())):
	n = int(input())
	bag = dict()
	for __ in range(n):
		temp = input()
		for q in temp:
			bag[q] = bag.get(q, 0) + 1
	flag = 0
	for q in bag.values():
		if q % n != 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	n = int(input())
	count = [0 for i in range(26)]
	for _ in range(n):
		s = input()
		for i in s:
			count[ord(i) - 97] += 1
	ans = True
	for i in range(26):
		if count[i] % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
from collections import defaultdict
from math import factorial
t = iinput()
while t:
	t -= 1
	n = iinput()
	s = []
	ans = 'YES'
	d = defaultdict(int)
	for _ in range(n):
		s.append(input())
	for e in s:
		for i in set(e):
			d[i] += e.count(i)
	for e in d:
		if d[e] % n != 0:
			ans = 'NO'
	print(ans)


from collections import Counter
input = __import__('sys').stdin.readline
for _ in range(int(input())):
	n = int(input())
	tmp = Counter(''.join([input().strip() for i in range(n)]))
	for val in tmp.values():
		if val % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	for i in range(n):
		s = input()
		l.append(s)
	d = {}
	f = 0
	for i in l:
		for j in i:
			if ord(j) not in d:
				d[ord(j)] = 1
			else:
				d[ord(j)] += 1
	for i in d.keys():
		if d[i] % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ls = []
	for _ in range(n):
		ls.append(input())
	temp = ''.join(ls)
	s = set(temp)
	st = True
	for i in s:
		if temp.count(i) % n != 0:
			st = False
			break
	print('YES' if st == True else 'NO')


for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		t = input()
		s = s + t
	ss = list(s)
	dic = {}
	for k in ss:
		dic[k] = dic.get(k, 0) + 1
	f = False
	for x in dic:
		if dic.get(x) != n and dic.get(x) % n != 0:
			f = True
			break
	if f:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	chars = {}
	for i in range(n):
		s = input()
		for letter in s:
			if letter not in chars:
				chars[letter] = 1
			else:
				chars[letter] += 1
	for key in chars:
		if chars[key] % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(n):
		arr.append(input())
	strin = [0] * 26
	for i in arr:
		for j in i:
			strin[ord(j) - 97] += 1
	abc = []
	for i in strin:
		if i % n == 0:
			abc.append(True)
		else:
			abc.append(False)
	if all(abc):
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		dic = {}
		for x in range(n):
			a = input()
			for x in a:
				if x in dic.keys():
					dic[x] += 1
				else:
					dic[x] = 1
		chk = 1
		for x in dic.values():
			if x % n != 0:
				chk = 0
				break
		print('YES' if chk == 1 else 'NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i in range(int(input())):
	n = int(input())
	alpha = {}
	for j in range(n):
		s = input()
		for k in range(len(s)):
			if s[k] in alpha.keys():
				alpha[s[k]] += 1
			else:
				alpha[s[k]] = 1
	flag = False
	for j in alpha.values():
		if j % n != 0:
			flag = True
			break
	if flag == True:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	total = ''
	n = int(input())
	for a in range(n):
		str = input()
		total += str
	ans = 'YES'
	st = set(total)
	for i in st:
		if total.count(i) % n != 0:
			ans = 'NO'
	print(ans)


t = int(input())
answer = []
for a in range(t):
	n = int(input())
	count = [0 for i in range(26)]
	for j in range(n):
		line = list(input())
		for k in line:
			count[ord(k) - 97] += 1
		ans = True
	for k in count:
		if k % n != 0:
			ans = False
			break
	if ans:
		answer.append('YES')
	else:
		answer.append('NO')
for b in answer:
	print(b)


for _ in range(int(input())):
	n = int(input())
	a = [0] * 26
	for i in range(n):
		for j in input().rstrip():
			a[ord(j) - 97] += 1
	ans = 'YES'
	for i in a:
		if i % n != 0:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for case in range(t):
	n = int(input())
	letras = []
	repeticiones = []
	for stri in range(n):
		string = input()
		for i in range(len(string)):
			if string[i] in letras:
				repeticiones[letras.index(string[i])] += 1
			else:
				letras.append(string[i])
				repeticiones.append(1)
	patata = 0
	for i in repeticiones:
		if not i % n == 0:
			patata = 1
	if patata == 1:
		print('NO')
	else:
		print('YES')


from collections import Counter
t = int(input())
for i in range(t):
	N = int(input())
	res = 'YES'
	l = []
	for j in range(N):
		l.append(input())
	l = ''.join(l)
	m = Counter(l)
	for k in m.values():
		if k % N != 0:
			res = 'NO'
	print(res)


import os
from sys import stdin, stdout

def solve(tc):
	n = int(stdin.readline().strip())
	alpha = [0 for i in range(26)]
	for i in range(n):
		s = stdin.readline().strip()
		for c in s:
			alpha[ord(c) - ord('a')] += 1
	ok = True
	for i in range(26):
		if alpha[i] % n:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')
tcs = 1
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


import collections

def fun(r, n):
	for x in r:
		if x % n != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	a = ''
	for i in range(n):
		a = a + input()
	d = collections.Counter(list(a))
	print(fun(list(d.values()), n))


from sys import stdin, stdout
from collections import Counter, OrderedDict
import math
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(str(val))
	cout('\n')
(t,) = mp()
for _ in range(t):
	(n,) = mp()
	C = Counter()
	for i in range(n):
		C.update(chars())
	for x in C:
		if C[x] % n:
			cout('NO\n')
			break
	else:
		cout('YES\n')


n = int(input())
for i in range(n):
	t = int(input())
	tempStr = ''
	temp = True
	for i in range(t):
		s = input()
		tempStr += s
	if len(tempStr) % t != 0:
		print('NO')
	else:
		tempSet = set(tempStr)
		for i in tempSet:
			if tempStr.count(i) % t != 0:
				print('NO')
				temp = False
				break
		if temp:
			print('YES')


from collections import defaultdict as dc
import math
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	x = dc(int)
	for i in range(n):
		s = input()[:-1]
		for j in s:
			x[j] += 1
	f = 0
	for i in x:
		if x[i] % n != 0:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


tests = int(input())
for i in range(tests):
	num = int(input())
	strings = []
	countDic = {}
	for j in range(num):
		word = list(input())
		for k in word:
			if k in countDic:
				countDic[k] += 1
			else:
				countDic[k] = 1
	values = list(countDic.values())
	flag = 'YES'
	for i in values:
		if i % num != 0:
			flag = 'NO'
	print(flag)


import sys
tc = int(sys.stdin.readline())
for _ in range(tc):
	n = int(sys.stdin.readline())
	res = dict()
	can = True
	for _ in range(n):
		temp = list(sys.stdin.readline().rstrip())
		for i in temp:
			if i not in res:
				res[i] = 1
			else:
				res[i] += 1
	for i in res:
		if res[i] % n != 0:
			can = False
	if can:
		print('YES')
	else:
		print('NO')


for x in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	r = 'YES'
	for i in d:
		if d[i] % n != 0:
			r = 'NO'
			break
	print(r)


t = int(input())
for i in range(t):
	n = int(input())
	c = []
	l1 = []
	l = []
	for j in range(n):
		s = input()
		l1 = list(s)
		l.extend(l1)
	c = list(set(l))
	x = len(l)
	a = True
	for z in c:
		y = l.count(z)
		if y % n != 0:
			a = False
	if a:
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.extend(list(input()))
	if n == 1:
		print('YES')
		continue
	c = Counter(l)
	c = dict(c)
	c = c.items()
	flag = True
	for (key, value) in c:
		if value % n != 0:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


def check(a, c):
	return sum([abs(a[i] - c ** i) for i in range(len(a))])
for i in range(int(input())):
	n = int(input())
	c = [0] * 26
	for i in range(n):
		for j in input():
			c[ord(j) - ord('a')] += 1
	ok = True
	for i in c:
		if i % n != 0:
			ok = False
			break
	print(['NO', 'YES'][ok])


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
letters = ascii_letters
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	have = dict()
	can = True
	for i in range(n):
		for g in input().strip():
			if g not in have:
				have[g] = 0
			have[g] += 1
	for i in have.items():
		if i[1] % n:
			can = False
			break
	print('YES' if can else 'NO')


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	ans = dict()
	for k in range(n):
		s1 = input()
		ans = Counter(ans) + Counter(s1)
	f = 0
	for j in ans.keys():
		if ans[j] % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	k = ''
	for i in range(n):
		s = input()
		k += s
	d = {}
	flag = 1
	for i in k:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	for (key, v) in d.items():
		if v % n != 0:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	ans = {}
	for letter in s:
		ans.setdefault(letter, 0)
		ans[letter] += 1
	ansss = 'YES'
	for value in ans.values():
		if value % n != 0:
			ansss = 'NO'
			break
	print(ansss)


for _ in range(int(input())):
	d = {}
	rounds = int(input())
	for number in range(rounds):
		l = input()
		l = list(l)
		for i in l:
			if i not in d:
				d[i] = 1
			else:
				d[i] += 1
	flag = 0
	for i in d:
		if d[i] % rounds == 0:
			continue
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	d = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
	for i in range(n):
		s = input()
		for c in s:
			d[c] += 1
	for s in d:
		if d[s] % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import defaultdict
T = int(input())
for t in range(T):
	n = int(input())
	c = defaultdict(int)
	for i in range(n):
		s = input()
		for x in s:
			c[x] += 1
	for l in c:
		if c[l] % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	arr = [0] * 26
	n = int(input())
	for i in range(n):
		s = input()
		for ch in s:
			arr[ord(ch) - ord('a')] += 1
	for c in arr:
		if c == 0:
			continue
		if c % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(0, int(input())):
	s = ''
	c = 0
	n = int(input())
	for i in range(0, n):
		x = input()
		s = s + x
	p = list(s)
	x = set(p)
	for i in x:
		if p.count(i) % n != 0:
			print('NO')
			c = -1
			break
	if c != -1:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = []
	st = ''
	ans = 0
	for j in range(n):
		s = str(input())
		st += s
	cv = set(st)
	for i in range(len(st)):
		l.append(st[i])
	for i in cv:
		if l.count(i) % n == 0:
			ans += 1
	if len(cv) == ans:
		print('YES')
	else:
		print('NO')
	ans = 0


def co(s, d):
	for i in s:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	f = 0
	for i in range(n):
		s = input()
		co(s, d)
	for i in d:
		if d[i] % n != 0:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


from collections import defaultdict

def solve():
	for _ in range(int(input())):
		n = int(input())
		count = defaultdict(int)
		for i in range(n):
			s = input('')
			for i in s:
				count[i] += 1
		flag = 0
		for i in count.keys():
			if count[i] % n != 0:
				flag = 1
				break
		if flag == 1:
			print('NO')
		else:
			print('YES')
solve()


from collections import defaultdict
t = int(input())
for _ in range(t):
	d = defaultdict(lambda : 0)
	n = int(input())
	for i in range(n):
		a = input()
		for i in a:
			if d[i] > 0:
				d[i] += 1
			else:
				d[i] = 1
	for i in d:
		if d[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter as cnt
t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	for i in range(n):
		tmp = list(input())
		l += tmp
	freq = cnt(l)
	ans = True
	for v in freq.values():
		if v % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


from collections import Counter
import string
for _ in range(int(input())):
	n = int(input())
	var = {}
	for i in string.ascii_lowercase:
		var[i] = 0
	for i in range(n):
		num = input()
		num = list(num)
		num = dict(Counter(num))
		for i in num:
			var[i] += num[i]
	for i in var:
		if var[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var, end='\n'):
	sys.stdout.write(str(var) + end)

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	c = C()
	n = int(data())
	for j in range(n):
		s = data()
		for k in s:
			c[k] += 1
	r = True
	for i in c.values():
		if i % n != 0:
			r = False
			break
	out(('YES', 'NO')[not r])


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
for _ in range(int(input())):
	n = int(input())
	a = [0] * 50
	for _ in range(n):
		for x in input():
			a[ord(x) - ord('a')] += 1
	ok = True
	for x in a:
		if x % n != 0:
			ok = False
			break
	print(['NO', 'YES'][ok])


for t in range(int(input())):
	n = int(input())
	arr = []
	for i in range(n):
		string = list(input())
		arr = arr + string
	unique = set(arr)
	broken = 0
	for i in unique:
		val = arr.count(i)
		if val % n != 0:
			broken += 1
			break
	if broken == 0:
		print('YES')
	else:
		print('NO')


import string
alpha = list(string.ascii_lowercase)
t = int(input())
for _ in range(t):
	freq = [0] * 26
	flag = False
	n = int(input())
	for _ in range(n):
		s = input()
		for i in range(len(s)):
			for j in range(len(alpha)):
				if s[i] == alpha[j]:
					freq[j] += 1
	for k in freq:
		if k % n == 0:
			continue
		else:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout

def read_int():
	return int(stdin.readline())
t = read_int()
for case_num in range(t):
	n = read_int()
	counter = dict()
	for i in range(n):
		s = stdin.readline()
		for c in s:
			if c not in counter:
				counter[c] = 0
			counter[c] += 1
	ok = True
	for key in counter:
		if counter[key] % n != 0:
			ok = False
			break
	stdout.write('YES\n' if ok else 'NO\n')


t = input()
t = int(t)
while t > 0:
	t = t - 1
	counts = dict()
	n = input()
	m = int(n)
	for num in range(m):
		st = input()
		for word in st:
			counts[word] = counts.get(word, 0) + 1
	ans = 0
	for (key, value) in counts.items():
		if value % m != 0:
			ans = 1
	if ans == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = [0] * 26
	s = []
	for i in range(n):
		s.append(input().strip(''))
	flag = 1
	for i in range(len(s)):
		for j in range(len(s[i])):
			l[ord(s[i][j]) - 97] += 1
	for values in l:
		if values % n != 0:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(i, a) = (int(input()), '')
	for j in range(0, i):
		a = a + input()
	dif = list(set(a))
	b = [a.count(j) for j in dif]
	c = 0 if all([j % i == 0 for j in b]) else 1
	print('YNEOS'[c::2])


t = int(input())
for i in range(t):
	n = int(input())
	s = ''
	a = []
	b = []
	for j in range(n):
		s1 = input()
		for k in s1:
			if k not in a:
				a.append(k)
		s += s1
	f = 0
	for j in a:
		if s.count(j) % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


from collections import *
for _ in range(int(input())):
	N = int(input())
	dic = defaultdict(int)
	for i in range(N):
		s = input()
		for j in s:
			dic[j] += 1
	temp = 0
	for i in dic:
		if dic[i] % N != 0:
			temp = 1
			break
	if temp:
		print('NO')
	else:
		print('YES')


def solve():
	n = int(input())
	stype = []
	snum = []
	for x in range(n):
		s = input()
		for y in s:
			if y not in stype:
				stype.append(y)
				snum.append(1)
			else:
				snum[stype.index(y)] += 1
	for x in snum:
		if x % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for x in range(t):
	print(solve())


def ans(s, n):
	d = {}
	for word in s:
		for ch in word:
			d[ch] = d.get(ch, 0) + 1
	for val in d.values():
		if val % n != 0:
			return 'NO'
	return 'YES'
T = int(input())
for i in range(T):
	n = int(input())
	s = []
	for j in range(n):
		s.append(input())
	print(ans(s, n))


import os
import sys
from io import BytesIO, IOBase
from collections import Counter as c

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		for i in range(n):
			s = input()
			if i == 0:
				d = c(s)
			else:
				e = c(s)
				for key in e:
					if key in d:
						d[key] += e[key]
					else:
						d[key] = e[key]
		for i in d:
			if d[i] % n != 0:
				print('NO')
				break
		else:
			print('YES')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import defaultdict
for _ in range(int(input())):
	flag = 1
	d = defaultdict(int)
	n = int(input())
	for i in range(n):
		s = input()
		for j in range(len(s)):
			d[s[j]] += 1
	x = list(d.values())
	for i in range(len(x)):
		if x[i] % n != 0:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = ''
	for _ in range(n):
		s += input()
	if len(s) % n == 0:
		s1 = Counter(s)
		f = 0
		for i in s1.values():
			if i % n != 0:
				f = 1
				break
		print('YES') if f == 0 else print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = ''
	for j in range(n):
		s += input()
	a = []
	s1 = set(s)
	for k in s1:
		a.append(s.count(k))
	flag = 0
	for l in a:
		if l % n == 0:
			pass
		else:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	d = {}
	flag = 0
	for __ in range(n):
		s = input()
		l.append(s)
	for i in range(n):
		for j in range(len(l[i])):
			if l[i][j] in d:
				d[l[i][j]] += 1
			else:
				d[l[i][j]] = 1
	for k in d:
		if d[k] % n != 0:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


N = int(input())
for i in range(N):
	R = int(input())
	d = {}
	for j in range(R):
		arr = input()
		for a in arr:
			if a not in d:
				d[a] = 1
			else:
				d[a] += 1
	ans = 'YES'
	for k in d:
		if d[k] % R != 0:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for r in range(t):
	n = int(input())
	z = ''
	w = ''
	p = []
	f = []
	c = 0
	for i in range(n):
		s = input()
		w += s
	for i in range(97, 123):
		f.append(chr(i))
	for i in f:
		p.append(w.count(i))
	for i in p:
		if i % n != 0:
			c = 1
			break
	if c == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	str = 'YES'
	for i in range(n):
		a = input()
		for j in a:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	for k in d:
		if d[k] % n != 0:
			str = 'NO'
		else:
			continue
	print(str)


t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	flag = 1
	for i in range(n):
		s = input()
		for c in s:
			if c not in d:
				d[c] = 0
			d[c] = d[c] + 1
	for key in d.keys():
		if d[key] % n:
			print('NO')
			flag = 0
			break
	if flag:
		print('YES')


from fractions import Fraction
from collections import defaultdict
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	for i in range(n):
		s = input()
		l.append(s)
	d = {}
	f = 0
	for i in l:
		for j in i:
			if ord(j) not in d:
				d[ord(j)] = 1
			else:
				d[ord(j)] += 1
	for i in d.keys():
		if d[i] % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	text = ''
	for i in range(n):
		text += input()
	c = Counter(text)
	if sum(c.values()) % n != 0:
		print('NO')
		continue
	flag = True
	for value in c.values():
		if value % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


t = int(input())
from collections import defaultdict
for _ in range(t):
	n = int(input())
	alphaDict = defaultdict(int)
	for _ in range(n):
		for char in input():
			alphaDict[char] += 1
	for (char, count) in alphaDict.items():
		if count % n != 0:
			output = 'NO'
			break
	else:
		output = 'YES'
	print(output)


T = int(input().rstrip())

def solve(all_strings):
	all_chr_count = {}
	for s in all_strings:
		for c in s:
			if c not in all_chr_count:
				all_chr_count[c] = 0
			all_chr_count[c] += 1
	num_str = len(all_strings)
	for (k, v) in all_chr_count.items():
		if v % num_str != 0:
			return 'NO'
	return 'YES'
for test in range(T):
	n = int(input().rstrip())
	all_strings = [input() for i in range(n)]
	print(solve(all_strings))


t = int(input())
import string
for asjkd in range(t):
	n = int(input())
	d = dict.fromkeys(string.ascii_lowercase, 0)
	for i in range(n):
		l = input()
		for j in range(len(l)):
			d[l[j]] += 1
	t = True
	for i in d:
		if d[i] % n != 0:
			t = False
			break
	if t:
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	n = int(input())
	l = []
	for g in range(n):
		o = input()
		l.append(o)
	d = {}
	for i in l:
		for y in i:
			if y not in d:
				d[y] = 1
			else:
				d[y] += 1
	if n % 2 == 0:
		ret = 'YES'
		for p in d.values():
			if p % 2 != 0:
				ret = 'NO'
				break
		print(ret)
	else:
		ret = 'YES'
		for p in d.values():
			if p % n != 0:
				ret = 'NO'
				break
		print(ret)


for _ in range(int(input())):
	n = int(input())
	a = ''
	for _ in range(n):
		a = a + input()
	for i in a:
		if a.count(i) % n != 0:
			print('NO')
			break
	else:
		print('YES')


def main(args):
	t = int(input())
	for i in range(t):
		li = [0] * 26
		n = int(input())
		for j in range(n):
			m = input()
			for k in m:
				li[ord(k) - 97] += 1
		flag = 0
		for j in li:
			if j % n != 0:
				flag = 1
				break
		if flag:
			print('NO')
		else:
			print('YES')
import sys
sys.exit(main(sys.argv))


t = int(input())
ansl = []
for _ in range(t):
	n = int(input())
	c_cnts = [0] * 26
	for _i in range(n):
		s = input()
		for si in s:
			num = ord(si) - ord('a')
			c_cnts[num] += 1
	if all([c % n == 0 for c in c_cnts]):
		ansl.append('YES')
	else:
		ansl.append('NO')
for a in ansl:
	print(a)


t = int(input())
while t != 0:
	n = int(input())
	k = n
	lst = []
	while n != 0:
		st = input()
		lst.append(st)
		n = n - 1
	sss = ''
	sss = sss.join(lst)
	pp = {}
	for item in sss:
		if item in pp:
			pp[item] += 1
		else:
			pp[item] = 1
	flag = 0
	for (key, value) in pp.items():
		if value % k != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')
	t = t - 1


ans = []
for _ in range(int(input())):
	memo = {}
	n = int(input())
	for _ in range(n):
		for char in input():
			if char in memo:
				memo[char] += 1
			else:
				memo[char] = 1
	for char in memo:
		if memo[char] % n:
			ans.append('NO')
			break
	else:
		ans.append('YES')
print('\n'.join(ans))


t = int(input())
for i in range(t):
	n = int(input())
	ans = True
	d = [0] * 26
	for j in range(n):
		st = str(input().strip())
		for ch in st:
			d[ord(ch) - ord('a')] += 1
	for j in range(26):
		if d[j] % n != 0:
			ans = False
			break
	if not ans:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	lst = []
	flag = 1
	for i in range(n):
		string = input()
		lst.append(string)
	ans = [0] * 26
	for string in lst:
		for num in string:
			ans[ord(num) - 97] += 1
	for j in ans:
		if j % n != 0:
			flag = -1
			break
	if flag == 1:
		print('YES')
	elif flag == -1:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s1 = list(input())
		for i in range(len(s1)):
			if s1[i] not in d:
				d[s1[i]] = 1
			else:
				d[s1[i]] += 1
	p = 0
	for i in d.keys():
		if d[i] % n != 0:
			p = 1
	if p == 1:
		print('NO')
	else:
		print('YES')


import sys
import bisect
t = int(input())
mod = 10 ** 9 + 7
for _ in range(t):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for i in range(len(s)):
			d[s[i]] = d.get(s[i], 0) + 1
	ch = 1
	for i in d:
		if d[i] % n != 0:
			ch = 0
	if ch == 1:
		print('YES')
	else:
		print('NO')


from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
	n = int(stdin.readline())
	dic = {}
	for i in range(n):
		s = stdin.readline()[:-1]
		for j in s:
			if j not in dic:
				dic[j] = 0
			dic[j] += 1
	ans = 'YES'
	for i in dic:
		if dic[i] % n != 0:
			ans = 'NO'
	print(ans)


from sys import stdin, stdout
from collections import defaultdict
test = int(stdin.readline())
for _ in range(test):
	n = int(stdin.readline())
	freq = defaultdict(int)
	for i in range(n):
		s = stdin.readline().strip()
		for i in s:
			freq[i] += 1
	ok = True
	for (k, v) in freq.items():
		if v % n:
			ok = False
			break
	print('YES') if ok else print('NO')


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	n = Int()
	C = defaultdict(int)
	for i in range(n):
		s = input()
		for i in s:
			C[i] += 1
	ok = 'YES'
	for i in C:
		if C[i] % n:
			ok = 'NO'
	print(ok)


test_cases = int(input())
for _ in range(test_cases):
	n = int(input())
	count_list = [0 for i in range(26)]
	for j in range(n):
		s = input()
		for ch in s:
			count_list[ord(ch) - 97] += 1
	answer = True
	for i in range(26):
		if count_list[i] % n != 0:
			answer = False
			break
	if answer:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	count = [0 for j in range(26)]
	for j in range(n):
		s = input()
		for c in s:
			count[ord(c) - ord('a')] += 1
	ans = True
	for j in range(26):
		if count[j] % n > 0:
			ans = False
	print('YES' if ans else 'NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
from collections import Counter, defaultdict, deque

def int1():
	return int(input())

def map1():
	return map(int, input().split())

def list1():
	return list(map(int, input().split()))
mod = pow(10, 9) + 7

def solve():
	n = int1()
	s1 = ''
	for i in range(n):
		s = input()
		s1 = s1 + s
	k = Counter(s1)
	for i in k:
		if k[i] % n != 0:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	solve()


import sys

def input():
	a = sys.stdin.readline()
	if a[-1] == '\n':
		a = a[:-1]
	return a

def print(*argv):
	n = len(argv)
	for i in range(n):
		if i == n - 1:
			sys.stdout.write(str(argv[i]) + '\n')
		else:
			sys.stdout.write(str(argv[i]) + ' ')

def lcm(x, y):
	from math import gcd
	return x * y / gcd(x, y)

def solve(n, lst):
	cnt = [0] * 26
	for i in lst:
		for j in i:
			cnt[ord(j) - 97] += 1
	for i in range(26):
		if cnt[i] % n != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	lst = []
	for i in range(n):
		lst.append(input())
	print(solve(n, lst))


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	freq = defaultdict(lambda : 0)
	for x in range(n):
		s = input()
		for char in s:
			freq[char] += 1
	for key in freq:
		if freq[key] % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = ['' for i in range(n)]
	for i in range(n):
		s[i] = input()
	dicts = {}
	for i in range(n):
		for char in s[i]:
			if char in dicts:
				dicts[char] += 1
			else:
				dicts[char] = 1
	yn = True
	for i in dicts:
		if dicts[i] % n != 0:
			yn = False
	if yn:
		print('YES')
	else:
		print('NO')


from collections import Counter

def ck(data, n):
	for i in data:
		if data[i] % n != 0:
			return False
	return True
for i in range(int(input())):
	n = int(input())
	s = ''
	for k in range(n):
		s = s + input()
	data = Counter(s)
	ans = ck(data, n)
	if ans:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	S = int(input())
	l = [0 for i in range(26)]
	a = ord('a')
	for j in range(S):
		word = input()
		for let in word:
			l[ord(let) - a] += 1
	print('NO' if any((let % S for let in l)) else 'YES')


import sys
import math
import collections

def read():
	return sys.stdin.readline()
T = int(read())
for _ in range(T):
	n = int(read())
	dic = collections.Counter()
	for _ in range(n):
		s = read()[:-1]
		dic.update(collections.Counter(s))
	flag = True
	for (k, v) in dic.items():
		if v % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	d = {}
	f = ''
	for j in range(n):
		s = list(input())
		f = s[0]
		for i in s:
			if i not in d:
				d[i] = 0
			d[i] += 1
	r = d[f]
	a = True
	for j in d:
		if d[j] % n != 0:
			a = False
	if a:
		print('YES')
	else:
		print('NO')


from collections import defaultdict as dd
res = ['YES', 'NO']
for _ in range(int(input())):
	d = dd(int)
	n = int(input())
	i = 0
	for _ in range(n):
		strs = input()
		for char in strs:
			d[char] += 1
	for val in d.values():
		if val % n != 0:
			i = 1
			break
	print(res[i])


for i in range(int(input())):
	a = {}
	n = int(input())
	for _ in range(n):
		s = input()
		for i in s:
			if i in a:
				a[i] += 1
			else:
				a[i] = 1
	c = 0
	for j in a:
		if a[j] % n == 0:
			c += 1
	if c == len(a):
		print('YES')
	else:
		print('NO')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	dic = Counter()
	count = 0
	for i in range(n):
		s = ips()
		dic += Counter(s)
		count += len(s)
	flag = True
	for i in dic:
		if dic[i] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
answers = list()
for i in range(t):
	n = int(input())
	l = list()
	s = set()
	for j in range(n):
		string = input()
		l.append(string)
		for k in string:
			s.add(k)
	string = ''
	for j in l:
		string += j
	l = list(s)
	answer = 'YES'
	for j in l:
		if string.count(j) % n != 0:
			answer = 'NO'
			break
	answers.append(answer)
for i in answers:
	print(i)


T = int(input())
for I in range(0, T):
	N = int(input())
	X = {}
	for J in range(0, N):
		Y = input()
		for K in Y:
			if K in list(X):
				X[K] += 1
			else:
				X[K] = 1
	Z = True
	for J in list(X):
		if X[J] % N != 0:
			Z = False
			print('NO')
			break
	if Z:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = ''
	f = 0
	for i in range(n):
		s = s + input()
	for i in range(len(s)):
		if s.count(s[i]) % n != 0:
			f = 1
			break
	print('NO' if f == 1 else 'YES')


import sys, collections, math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	n = int(input())
	arr = []
	d = collections.defaultdict(lambda : 0)
	for i in range(n):
		arr.append(input())
	flag = True
	for i in range(n):
		for j in range(len(arr[i])):
			d[arr[i][j]] += 1
	for (i, j) in d.items():
		if j % n:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


def check1(strings, n):
	count = 0
	for i in strings:
		count = count + len(i)
	if count % n == 0:
		return True
	else:
		return False

def check2(strings, n):
	letters = []
	for i in strings:
		lt = list(i)
		letters = letters + lt
	lt_set = set(letters)
	lt_set = list(lt_set)
	count = 0
	for i in range(len(lt_set)):
		for j in range(len(letters)):
			if lt_set[i] == letters[j]:
				count = count + 1
		if count % n == 0:
			continue
		else:
			return False
	else:
		return True
test_case = int(input())
for _ in range(test_case):
	n = int(input())
	strings = []
	for i in range(n):
		string = input()
		strings.append(string)
	if check1(strings, n) and check2(strings, n):
		print('YES')
	else:
		print('NO')


from collections import Counter
for i in range(int(input())):
	f = False
	di = dict()
	n = int(input())
	for j in range(n):
		li = list(input())
		counter = Counter(li)
		keys = list(counter.keys())
		values = list(counter.values())
		for k in range(len(keys)):
			if keys[k] not in di:
				di[keys[k]] = values[k]
			else:
				di[keys[k]] = di[keys[k]] + values[k]
	val = di.values()
	for p in val:
		if p % n == 0:
			f = True
		else:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


from collections import Counter
t = int(input())
for j in range(t):
	n = int(input())
	counts = Counter()
	for i in range(n):
		s = input()
		for a in s:
			counts[a] += 1
	print('YES' if all((counts[a] % n == 0 for a in counts)) else 'NO')


t = int(input())
while t > 0:
	n = int(input())
	lst = []
	dit = {}
	for i in range(n):
		lst.append(input())
		for j in range(len(lst[i])):
			if lst[i][j] in dit:
				dit[lst[i][j]] += 1
			else:
				dit[lst[i][j]] = 1
	f = 1
	for i in dit:
		if dit[i] % n != 0:
			print('NO')
			f = 0
			break
	if f == 1:
		print('YES')
	t = t - 1


from collections import Counter
for ad in range(int(input())):
	n = int(input())
	l = []
	s = ''
	for i in range(n):
		s += input()
	c = Counter(s)
	val = c.values()
	t = 0
	for i in val:
		if i % n == 0:
			continue
		else:
			t = 1
			break
	if t == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = []
	n = int(input())
	for i in range(n):
		s = a.append(list(input()))
	b = [j for sublist in a for j in sublist]
	ok = True
	for i in set(b):
		if b.count(i) % n != 0:
			ok = False
			print('NO')
			break
	if ok:
		print('YES')


test = int(input())
for _ in range(test):
	n = int(input())
	hm = {}
	for _ in range(n):
		s = input()
		for c in s:
			hm[c] = hm.get(c, 0) + 1
	flag = True
	for (k, v) in hm.items():
		if v % n:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for tt in range(t):
	n = int(input())
	count = [0 for i in range(1000)]
	for i in range(n):
		s = input()
		for i in range(len(s)):
			count[ord(s[i])] += 1
	flag = True
	for i in range(len(count)):
		if count[i] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = []
	c = {}
	flag = 0
	for i in range(n):
		s.append(input())
	for string in s:
		for letter in string:
			c[letter] = c.get(letter, 0) + 1
	for each in c:
		if c[each] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


T = int(input())
while T > 0:
	n = int(input())
	count = [0] * 26
	for i in range(n):
		temp = input()
		for j in range(len(temp)):
			count[ord(temp[j]) - ord('a')] += 1
	form = True
	for i in range(26):
		if count[i] % n != 0:
			form = False
			break
	if form is True:
		print('YES')
	else:
		print('NO')
	T -= 1


for _ in range(int(input())):
	t = [[0 for i in range(2)] for i in range(26)]
	for i in range(97, 123):
		t[i - 97][0] = chr(i)
	n = int(input())
	for __ in range(n):
		temp = input()
		for j in range(len(temp)):
			for k in range(26):
				if t[k][0] == temp[j]:
					t[k][1] += 1
	ans = True
	for i in range(26):
		if t[i][1] % n != 0:
			print('NO')
			ans = False
			break
	if ans:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	d = dict()
	for i in range(n):
		a = input()
		for j in range(len(a)):
			if len(d) == 0:
				d[a[j]] = 1
			elif a[j] in d.keys():
				d[a[j]] += 1
			else:
				d[a[j]] = 1
	count = 0
	for x in d.values():
		if x % n == 0:
			count += 1
		else:
			break
	if count == len(d):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = ''
	for j in range(0, n):
		s = s + input()
	s = list(s)
	mySet = set(s)
	canBeEqual = True
	for j in mySet:
		if s.count(j) % n != 0:
			canBeEqual = False
			break
	if canBeEqual:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def rvfl(the_list, val):
	return [value for value in the_list if value != val]

def inp():
	return int(input())

def niinp():
	return input()

def inlt():
	return list(input().split())

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
x = inp()
splitat = []
countlist = []
answers = []
divisgood = 0
for i in range(x):
	splitat = []
	divisgood = 0
	yees = inp()
	for i in range(yees):
		strin = niinp()
		for i in strin:
			splitat.append(i)
		splitat.remove('\n')
	a = splitat.count('a')
	b = splitat.count('b')
	c = splitat.count('c')
	d = splitat.count('d')
	e = splitat.count('e')
	f = splitat.count('f')
	g = splitat.count('g')
	h = splitat.count('h')
	i = splitat.count('i')
	j = splitat.count('j')
	k = splitat.count('k')
	l = splitat.count('l')
	m = splitat.count('m')
	n = splitat.count('n')
	o = splitat.count('o')
	p = splitat.count('p')
	q = splitat.count('q')
	r = splitat.count('r')
	s = splitat.count('s')
	t = splitat.count('t')
	u = splitat.count('u')
	v = splitat.count('v')
	w = splitat.count('w')
	x = splitat.count('x')
	y = splitat.count('y')
	z = splitat.count('z')
	countlist = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
	countlist = rvfl(countlist, 0)
	for i in countlist:
		if i % yees == 0:
			divisgood += 1
	if divisgood == len(countlist):
		answers.append('YES')
	else:
		answers.append('NO')
for i in answers:
	print(i)


import sys
t = int(sys.stdin.readline())
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for num in range(t):
	n = int(sys.stdin.readline())
	key = ''
	ls = []
	for num in range(n):
		i = sys.stdin.readline().strip()
		key += i
	for charac in alphabet:
		ls.append(key.count(charac))
	A = 'YES'
	for num in ls:
		if num % n != 0:
			A = 'NO'
	print(A)


from collections import defaultdict
t = int(input())
for test in range(t):
	hash = defaultdict(lambda : 0)
	n = int(input())
	for st in range(n):
		cstr = input()
		for ch in list(cstr):
			hash[ch] += 1
	ans = True
	for i in hash.values():
		if i >= n:
			if i % n == 0:
				continue
			else:
				ans = False
				break
		else:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


def check(str, n):
	count = dict()
	for i in str:
		count[i] = count.get(i, 0) + 1
	flag = True
	for (key, value) in count.items():
		if value % n == 0:
			flag = True
			continue
		else:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')
for i in range(int(input())):
	str = ''
	n = int(input())
	for j in range(n):
		str = str + input()
	check(str, n)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	n = int(input())
	strings = []
	for x in range(n):
		strings.append(input())
	freq = [0 for x in range(26)]
	for s in strings:
		for c in s:
			freq[ord(c) - ord('a')] += 1
	ok = 'YES'
	for c in range(26):
		if freq[c] % n:
			ok = 'NO'
			break
	print(ok)


from sys import *
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			d[j] = d.get(j, 0) + 1
	ch = 1
	for (i, j) in d.items():
		if j % n != 0:
			ch = 0
	if ch == 0:
		stdout.write('NO\n')
	else:
		stdout.write('YES\n')


t = int(input())
while t > 0:
	dict1 = {}
	n = int(input())
	for i in range(n):
		s = input()
		for i in s:
			if i not in dict1:
				dict1[i] = 1
			else:
				dict1[i] += 1
	flag = 0
	for i in dict1.keys():
		if dict1[i] % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


import sys
import collections
import math

def countingSort(arr, exp1):
	n = len(arr)
	output = [0] * n
	count = [0] * 10
	for i in range(0, n):
		index = arr[i] / exp1
		count[int(index % 10)] += 1
	for i in range(1, 10):
		count[i] += count[i - 1]
	i = n - 1
	while i >= 0:
		index = arr[i] / exp1
		output[count[int(index % 10)] - 1] = arr[i]
		count[int(index % 10)] -= 1
		i -= 1
	i = 0
	for i in range(0, len(arr)):
		arr[i] = output[i]

def radixSort(arr):
	max1 = max(arr)
	exp = 1
	while max1 / exp > 0:
		countingSort(arr, exp)
		exp *= 10

def countSort(arr):
	output = [0 for i in range(256)]
	count = [0 for i in range(256)]
	ans = ['' for _ in arr]
	for i in arr:
		count[ord(i)] += 1
	for i in range(256):
		count[i] += count[i - 1]
	for i in range(len(arr)):
		output[count[ord(arr[i])] - 1] = arr[i]
		count[ord(arr[i])] -= 1
	for i in range(len(arr)):
		ans[i] = output[i]
	return ans

def partition(arr, low, high):
	i = low - 1
	pivot = arr[high]
	for j in range(low, high):
		if arr[j] < pivot:
			i = i + 1
			(arr[i], arr[j]) = (arr[j], arr[i])
	(arr[i + 1], arr[high]) = (arr[high], arr[i + 1])
	return i + 1

def quickSort(arr, low, high):
	if low < high:
		pi = partition(arr, low, high)
		quickSort(arr, low, pi - 1)
		quickSort(arr, pi + 1, high)

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
t = int(input())
for i in range(t):
	n = int(input())
	res = []
	d = collections.Counter()
	for i in range(n):
		s = input()
		res.append(s)
		d += collections.Counter(s)
	if n == 1:
		print('YES')
		continue
	for (k, v) in d.items():
		if v % n:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	ar = [0] * 26
	n = int(input())
	for i in range(n):
		s = input()
		for j in s:
			ar[ord(j) - 97] += 1
	f = True
	for i in range(26):
		if ar[i] % n != 0:
			f = False
	if f:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ts = 0
	dicti = {}
	for z in range(n):
		s = input()
		ts += len(s)
		ml = []
		for i in s:
			if i not in ml:
				ml.append(i)
				if i not in dicti:
					dicti[i] = s.count(i)
				else:
					dicti[i] += s.count(i)
	if ts % n != 0:
		print('NO')
	else:
		c = 0
		for v in dicti.values():
			if v % n != 0:
				c = 1
				break
		print('NO' if c else 'YES')


import sys
sys.setrecursionlimit(2000)
n = int(input())
for i in range(n):
	patterns = {}
	q = int(input())
	strings = []
	for i in range(q):
		strings.append(input())
	for string in strings:
		for c in string:
			patterns[c] = patterns.get(c, 0) + 1
	possible = True
	for (key, value) in patterns.items():
		if value % q != 0:
			possible = False
	if possible:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout

def read_int():
	return int(stdin.readline())
t = read_int()
for case_num in range(t):
	n = read_int()
	counter = [0 for _ in range(26)]
	for i in range(n):
		s = stdin.readline().strip()
		for c in s:
			counter[ord(c) - ord('a')] += 1
	ok = True
	for count in counter:
		if count % n != 0:
			ok = False
			break
	stdout.write('YES\n' if ok else 'NO\n')


def main():
	for _ in range(int(input())):
		n = int(input())
		c = [0] * 26
		for i in range(n):
			s = input()
			for j in range(26):
				c[j] += s.count(chr(ord('a') + j))
		ok = True
		for j in c:
			if j % n:
				ok = False
		print('YES' if ok else 'NO')
main()


def solve():
	length = 0
	char = [0] * 26
	n = int(input())
	for i in range(n):
		str = input()
		for x in str:
			char[ord(x) - ord('a')] += 1
	for x in char:
		if x % n != 0:
			print('NO')
			return
	print('YES')
t = int(input())
while t:
	t -= 1
	solve()


t = int(input())
s = ''
d = {}
good = False
while t:
	n = int(input())
	for i in range(0, n):
		s += str(input())
	for i in s:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	for (k, v) in d.items():
		if v % n != 0:
			good = False
			break
		good = True
	if good:
		print('YES')
	else:
		print('NO')
	d = {}
	s = ''
	t -= 1


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	strings = []
	for i in range(n):
		strings.append(input())
	d = defaultdict(lambda : 0)
	for i in strings:
		for j in i:
			d[j] += 1
	flag = 1
	for i in d:
		if d[i] % n != 0:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


from collections import defaultdict

def checkCount(charCount, n):
	for (char, count) in charCount.items():
		if count % n != 0:
			return 'NO'
	return 'YES'
testCases = input()
for i in range(int(testCases)):
	charCount = defaultdict(int)
	n = int(input())
	for j in range(int(n)):
		s = input()
		for char in s:
			charCount[char] += 1
	res = checkCount(charCount, n)
	print(res)


import sys
from collections import Counter

def inputt():
	return sys.stdin.readline().strip()

def printt(n):
	sys.stdout.write(str(n) + '\n')

def listt():
	return [int(i) for i in inputt().split()]
t = int(inputt())
for _ in range(t):
	n = int(inputt())
	st = ''
	for i in range(n):
		s = inputt()
		st = st + s
	dic = Counter(st)
	c = 0
	for (key, values) in dic.items():
		if values % n == 0:
			c += 1
	if c == len(dic):
		printt('YES')
	else:
		printt('NO')


for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in range(len(s)):
			if s[j] in d:
				d[s[j]] += 1
			else:
				d[s[j]] = 1
	flag = 0
	for i in d:
		if d[i] % n != 0:
			flag = 1
			break
	if flag == 0 or n == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	d = {}
	for _ in range(n):
		str = input()
		for i in str:
			if i not in d:
				d[i] = 1
			else:
				d[i] += 1
	l = []
	for i in d:
		if d[i] % n == 0:
			l.append('YES')
		else:
			l.append('NO')
	if 'NO' in l:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	times = int(input())
	char_dict = {}
	for i in range(times):
		string = input()
		for i in string:
			char_dict[i] = char_dict.get(i, 0) + 1
	flag = True
	for i in char_dict:
		if char_dict[i] % times != 0:
			flag = False
			break
	print('YES' if flag else 'NO')


from collections import Counter
for _ in range(int(input())):
	strings = []
	count = int(input())
	for _ in range(count):
		strings.extend(list(input()))
	c = Counter(strings)
	check = True
	for i in c:
		if check and c[i] % count:
			check = False
	print('YES') if check else print('NO')


T = int(input())
for _ in range(T):
	ref = dict()
	N = int(input())
	for i in range(N):
		s = input()
		for t in s:
			ref[t] = ref.get(t, 0) + 1
	ans = True
	for b in ref.values():
		if b % N != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	d = {}
	n = int(input())
	for j in range(n):
		s = input()
		for k in range(len(s)):
			if s[k] in d:
				d[s[k]] += 1
			else:
				d[s[k]] = 1
	if all((value % n == 0 for value in d.values())):
		print('YES')
	else:
		print('NO')


t = int(input())
s = []
ss = ''
sk = []
k = 0
for i in range(t):
	n = int(input())
	for j in range(0, n):
		s.append(input())
		ss = ss + s[j]
	sss = list(set(ss))
	for j in range(0, len(sss)):
		sk.append(ss.count(sss[j]))
	for j in range(0, len(sk)):
		if sk[j] == n or sk[j] % n == 0:
			k += 1
	if k == len(sk):
		print('YES')
	else:
		print('NO')
	k = 0
	s = []
	ss = ''
	sk = []


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		_ = input()
		print('YES')
	else:
		db = defaultdict(int)
		check = 0
		for _ in range(n):
			temp = input()
			for t in temp:
				db[t] += 1
		for v in db.values():
			if v % n != 0:
				check += 1
				break
		if check > 0:
			print('NO')
		else:
			print('YES')


for _ in range(int(input())):
	d = dict()
	n = int(input())
	con = True
	for i in range(n):
		for j in str(input()):
			try:
				d[j] += 1
			except:
				d[j] = 1
	for k in d:
		if d[k] % n:
			print('NO')
			con = False
			break
	if con:
		print('YES')


for _ in range(int(input())):
	hash_map = dict()
	n = int(input())
	for i in range(n):
		for k in input():
			hash_map[k] = hash_map.get(k, 0) + 1
	for values in hash_map.values():
		if values % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	li = []
	c = 0
	n = int(input())
	for j in range(n):
		st = input()
		li.append(st)
	final = ''.join(li)
	eb = list(set(final))
	for i in eb:
		if final.count(i) % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	alphabets = {}
	for i in range(n):
		s = input()
		for char in s:
			if not alphabets.get(char):
				alphabets[char] = 1
			else:
				alphabets[char] += 1
	YES_FLAG = True
	for val in alphabets.values():
		if val % n != 0:
			YES_FLAG = False
			print('NO')
			break
	if YES_FLAG:
		print('YES')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	s1 = set(s)
	for i in s1:
		if s.count(i) % n != 0:
			print('NO')
			break
	else:
		print('YES')


n = int(input())
for i in range(n):
	d = []
	a = int(input())
	for j in range(a):
		s = input()
		d += s
	d.sort()
	k = 1
	ok = True
	for h in range(1, len(d)):
		if d[h - 1] == d[h]:
			k += 1
		else:
			if k % a != 0:
				ok = False
				break
			k = 1
	if k % a != 0:
		ok = False
	if ok:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ct = [0 for _ in range(26)]
	for _ in range(n):
		for x in input():
			ct[ord(x) - ord('a')] += 1
	flag = False
	for x in ct:
		if x % n != 0:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')


n = int(input())
for _ in range(n):
	s = ''
	k = int(input())
	d = dict()
	for _ in range(k):
		s += input()
	for c in s:
		try:
			d[c] += 1
		except KeyError:
			d[c] = 1
	for i in d.values():
		if i % k != 0:
			print('NO')
			break
	else:
		print('YES')


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		n = int(stdin.readline())
		d = dict()
		for _ in range(n):
			s = stdin.readline().strip()
			for c in s:
				d[c] = d.get(c, 0) + 1
		success = True
		for k in d.keys():
			if d[k] % n != 0:
				success = False
				break
		if success:
			stdout.write('YES\n')
		else:
			stdout.write('NO\n')
main()


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	mp = defaultdict(lambda : 0)
	for i in range(n):
		s = input()
		s = list(s)
		for i in s:
			mp[i] += 1
	flag = True
	for i in mp.keys():
		if mp[i] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
for _ in range(iinput()):
	n = iinput()
	s = []
	d = {}
	tot = 0
	for i in range(n):
		t = input()
		tot += len(t)
		for c in t:
			d[c] = d.get(c, 0) + 1
	tot /= n
	flag = True
	for key in d:
		if d[key] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


from string import ascii_lowercase

def main():
	t = int(input())
	for __ in range(t):
		n = int(input())
		alpha_count = dict.fromkeys(ascii_lowercase, 0)
		for i in range(n):
			s = input()
			for char in s:
				alpha_count[char] += 1
		flag = True
		for i in ascii_lowercase:
			if alpha_count[i] % n != 0:
				flag = False
				break
		if flag:
			print('YES')
		else:
			print('NO')
main()


for i in range(int(input())):
	l = int(input())
	q = []
	temp = 0
	x = ''
	for _ in range(l):
		s = input()
		x += s
	z = ''
	for _ in x:
		if _ not in z:
			z += _
	for op in z:
		q.append(x.count(op))
	for k in q:
		if k % l != 0:
			temp = 1
	if temp > 0:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	n = int(input())
	x = ''
	for i in range(n):
		x += input()
	y = list(x)
	z = set(y)
	flag = 0
	for i in z:
		if y.count(i) % n == 0:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')
	t = t - 1


for _ in range(int(input())):
	s1 = {}
	t = int(input())
	for i in range(t):
		s = input()
		for i in s:
			if i in s1:
				s1[i] += 1
			else:
				s1[i] = 1
	for i in s1:
		if s1[i] % t != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = ''.join((input() for i in range(n))).replace('\r', '')
	for freq in Counter(s).values():
		if freq % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list()
	for i in range(n):
		l.append(input())
	d = dict()
	for i in l:
		for j in i:
			if j not in d:
				d[j] = 1
			else:
				d[j] += 1
	ans = True
	for i in d:
		if d[i] % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


import sys
T = int(input())
for _ in range(T):
	n = int(input())
	A = [0 for i in range(26)]
	for i in range(n):
		s = input()
		for j in s:
			A[ord(j) - 97] = A[ord(j) - 97] + 1
	flag = 0
	for i in range(26):
		if A[i] % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(0, T):
	N = int(input())
	arr = []
	for i in range(0, N):
		arr.append(input())
	count = [0 for i in range(0, 26)]
	al = [chr(x) for x in range(ord('a'), ord('z') + 1)]
	flag = 1
	for i in range(0, 26):
		for b in arr:
			count[i] += b.count(al[i])
	for c in count:
		if c % N == 0:
			continue
		else:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


import sys
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	l = list(d.keys())
	ans = 'YES'
	for i in l:
		if d[i] % n != 0:
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	counts = {}
	for i in range(n):
		l = input()
		for j in l:
			if j in counts:
				counts[j] += 1
			else:
				counts[j] = 1
	correct = True
	for (k, count) in counts.items():
		if count % n != 0:
			correct = False
			break
	if correct:
		print('YES')
	else:
		print('NO')


def check(s, n):
	a = [0] * 26
	for i in range(len(s)):
		a[ord(s[i]) - 97] += 1
	for i in a:
		if i % n == 0:
			continue
		elif i == 0:
			continue
		else:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s1 = input()
		s += s1
	print(check(s, n))


import sys
from collections import defaultdict
t = int(sys.stdin.readline())
for _ in range(t):
	data = defaultdict(int)
	flag = True
	n = int(sys.stdin.readline())
	for i in range(n):
		s = sys.stdin.readline().strip()
		for l in s:
			data[l] += 1
	for (k, v) in data.items():
		if v % n != 0:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


from collections import Counter
for T in range(int(input())):
	n = int(input())
	d = Counter()
	for I in range(n):
		s = input()
		for i in s:
			d[i] += 1
	answer = 'YES'
	for i in d.values():
		if i % n:
			answer = 'NO'
			break
	print(answer)


def func(n):
	l = [0] * 26
	for _ in range(n):
		s = str(input().strip())
		for c in s:
			l[ord(c) - ord('a')] += 1
	for i in l:
		if i % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	print(func(n))


def main():
	t = int(input())
	while t:
		n = int(input())
		tang = []
		for i in range(n):
			tang.append(input())
		temp = 0
		k = 1
		for i in range(26):
			for j in range(n):
				temp += tang[j].count(chr(ord('a') + i))
			if temp % n != 0:
				print('NO')
				k = 0
				break
		if k:
			print('YES')
		t -= 1
main()


for t in range(int(input())):
	n = int(input())
	nums = [0] * 26
	for i in range(n):
		s = input()
		for c in s:
			nums[ord(c) - 97] += 1
	if all((i % n == 0 for i in nums)):
		print('YES')
	else:
		print('NO')


from collections import Counter
t = int(input())
for _ in range(t):
	S = list()
	n = int(input())
	for i in range(n):
		S.append(input())
	A = [0] * 26
	for i in range(n):
		for j in range(len(S[i])):
			A[ord(S[i][j]) - ord('a')] += 1
	c = 1
	for i in A:
		if i % n != 0:
			c = 0
			break
	if c == 0:
		print('NO')
	else:
		print('YES')


import sys, math, bisect
from collections import Counter, defaultdict as dd

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def l():
	return list(sp())

def strl():
	return list(strsp())

def sp():
	return map(int, data().split())

def strsp():
	return map(str, data().split())
for _ in range(int(data())):
	n = int(input())
	a = dd(lambda : 0)
	d = 0
	for i in range(n):
		b = input()
		for j in range(len(b)):
			a[b[j]] += 1
	for i in a:
		if a[i] % n != 0:
			d = -1
			break
	if d == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter
n = int(input())
for i in range(n):
	n_s = int(input())
	a = [Counter(list(input())) for _ in range(n_s)]
	r = {chr(c): 0 for c in range(ord('a'), ord('z') + 1)}
	for d in a:
		for k in d:
			r[k] += d[k]
	for k in r:
		if r[k] % n_s != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	d = {}
	flag = False
	for i in range(n):
		s = input()
		for i in s:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	for (k, v) in d.items():
		if v % n == 0:
			continue
		else:
			flag = True
	if flag:
		print('NO')
	else:
		print('YES')


for u in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			d[j] = d.get(j, 0) + 1
	c = 0
	for i in d:
		if d[i] % n == 0:
			c += 1
		else:
			break
	if c != len(d):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	d = {chr(i): 0 for i in range(93, 123)}
	n = int(input())
	for _ in range(n):
		s = input()
		for i in s:
			d[i] += 1
	for i in d.values():
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in ' ' * int(input()):
	n = int(input())
	k = ''
	for i in range(n):
		k += input().strip()
	for i in set(k):
		if k.count(i) % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	mydict = {}
	for i in range(n):
		temp = input()
		for j in range(len(temp)):
			if temp[j] in mydict:
				mydict[temp[j]] += 1
			else:
				mydict[temp[j]] = 1
	flag = True
	for i in mydict:
		if mydict[i] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	d = {}
	for __ in range(n):
		s = input().strip()
		for i in s:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	flag = 0
	for v in d.values():
		if v % n != 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for _ in range(n):
		l = input()
		a.append(l)
	d = {}
	k = 0
	for i in a:
		for j in range(len(i)):
			if i[j] in d:
				d[i[j]] += 1
			else:
				d[i[j]] = 1
	for i in d.keys():
		if d[i] % n != 0:
			k = 1
	if k == 1:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
import collections

def check(l):
	return collections.Counter(l)
for i in range(int(stdin.readline())):
	n = int(stdin.readline())
	s = ''
	for i in range(n):
		a = input()
		s = s + a
	l = sorted(s)
	arr = check(l)
	x = 0
	for (i, j) in arr.items():
		if j % n != 0:
			x = -1
			break
	if x == -1:
		print('NO')
	else:
		print('YES')


from collections import Counter
T = int(input())
for t in range(T):
	n = int(input())
	s = []
	for i in range(n):
		s += list(input())
	count = Counter(s)
	ans = 'YES'
	for v in count.values():
		if v % n != 0:
			ans = 'NO'
			break
	print(ans)


from collections import Counter
for _ in range(int(input())):
	p = []
	n = int(input())
	for i in range(n):
		p.extend(list(input()))
	p = Counter(p)
	for val in p:
		if p[val] % n != 0:
			print('NO')
			break
	else:
		print('YES')


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	di = {}
	n = int(stdin.readline())
	for i in range(n):
		t = input()
		for j in t:
			if j in di:
				di[j] += 1
			else:
				di[j] = 1
	counter = 0
	for i in di:
		if di[i] % n != 0:
			counter = 1
			break
	if counter == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	c = Counter(s)
	d = True
	for i in c:
		if c[i] % n != 0:
			d = False
			break
	if d:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
for c in range(int(input())):
	M = int(input())
	char_count = defaultdict(int)
	ans = True
	for i in range(M):
		s = input()
		for char in s:
			char_count[char] += 1
	for (_, count) in char_count.items():
		if count % M != 0:
			ans = False
			break
	print('YES') if ans else print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	letters = []
	for _ in range(n):
		letters += list(input())
	for l in set(letters):
		c = letters.count(l)
		if c % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	string = ''
	for i in range(n):
		string += str(input())
	dictt = dict(Counter(string))
	for i in dictt.values():
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


T = int(input())
for t in range(T):
	dic = {}
	N = int(input())
	for n in range(N):
		word = input()
		for w in word:
			if w not in dic.keys():
				dic[w] = 1
			else:
				dic[w] += 1
	for l in dic.values():
		if l % N != 0:
			print('NO')
			break
	else:
		print('YES')


def canChange(n, a):
	lst = [0] * 26
	for i in range(n):
		for j in a[i]:
			lst[ord(j) - 97] += 1
	for i in lst:
		if i % n != 0:
			return False
	return True
t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for i in range(n):
		a.append(input())
	if canChange(n, a):
		print('YES')
	else:
		print('NO')


import sys
from collections import defaultdict as dd
from collections import Counter as ccd
from itertools import permutations as pp
from itertools import combinations as cc
from random import randint as rd
from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq as hq
import math
mod = pow(10, 9) + 7

def inp(flag=0):
	if flag == 0:
		return input().strip()
	elif flag == 1:
		return int(input())
	else:
		return list(map(int, input().strip().split(' ')))

def inp_fast(flag=0):
	if flag == 0:
		return sys.stdin.readline()
	elif flag == 1:
		return int(sys.stdin.readline())
	else:
		return list(map(int, sys.stdin.readline().split()))
t = inp(1)
while t:
	t -= 1
	n = inp(1)
	d = dd(int)
	for i in range(n):
		s = inp()
		for c in s:
			d[c] += 1
	possible = True
	for c in d:
		if d[c] % n != 0:
			possible = False
	if possible == False:
		print('NO')
	else:
		print('YES')


def solve(strings, n):
	char_dict = [0] * 26
	for s in strings:
		for c in s:
			ind = ord(c) - ord('a')
			char_dict[ind] += 1
	for freq in char_dict:
		if freq % n != 0:
			return False
	return True

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		strings = []
		for _ in range(n):
			s = input()
			strings.append(s)
		answer = solve(strings, n)
		if answer:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	n = int(input())
	counts = dict()
	for j in range(n):
		s = input()
		for k in s:
			if k in counts:
				counts[k] += 1
			else:
				counts[k] = 1
	good = True
	for l in counts.values():
		if l % n != 0:
			good = False
			break
	if good:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
while t:
	n = int(input())
	flag = True
	strdict = defaultdict(lambda : 0)
	for _ in range(n):
		s = input()
		for char in s:
			strdict[char] += 1
	for char in strdict.keys():
		if strdict[char] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	s = []
	for _ in range(n):
		s.append(input())
	chars = [0] * 30
	for i in range(n):
		for j in s[i]:
			chars[ord(j) - 97] += 1
	no = False
	for i in chars:
		if i % n != 0 and i != 0:
			print('NO')
			no = True
			break
	if not no:
		print('YES')


test_cases = int(input())
for x in range(test_cases):
	tot_str = int(input())
	strs = {}
	res = 'YES'
	for y in range(tot_str):
		for z in input():
			if z not in strs:
				strs[z] = 0
			strs[z] += 1
	for val in strs.values():
		if val % tot_str != 0:
			res = 'NO'
			break
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	d = dict()
	c = 0
	for j in range(n):
		x = input()
		for k in x:
			if k not in d:
				d[k] = 1
			else:
				d[k] = d[k] + 1
	l = len(d)
	for (k, v) in d.items():
		if v % n == 0:
			c += 1
	if c == l:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	v = '1'
	flag = 0
	l = []
	for i in range(n):
		s = input()
		v = v + s
	for i in v[1:]:
		if i not in l:
			if v.count(i) % n != 0:
				flag = 1
				break
			l.append(i)
	if flag == 1:
		print('NO')
	else:
		print('YES')


import collections
t = input()
t = int(t)

def solve(s):
	s_dict = collections.Counter(s)
	for (k, v) in s_dict.items():
		if v % n != 0:
			print('NO')
			return
	print('YES')
	return
for i in range(t):
	n = input()
	n = int(n)
	s = ''
	for j in range(n):
		s += input()
	solve(s)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		d = {}
		le = 0
		for _ in range(n):
			s = input()
			le += len(s)
			for i in s:
				if i not in d:
					d[i] = 1
				else:
					d[i] += 1
		if le % n != 0:
			print('NO')
			continue
		for k in d:
			if d[k] % n != 0:
				print('NO')
				break
		else:
			print('YES')
main()


def count_char(arr, hash_table):
	arr = list(arr)
	for a in arr:
		if hash_table.get(a):
			hash_table[a] += 1
		else:
			hash_table[a] = 1
	return hash_table
for _ in range(int(input())):
	n = int(input())
	mapped_value = dict()
	for _ in range(n):
		mapped_value = count_char(input(), mapped_value)
	error = False
	for k in mapped_value.keys():
		if mapped_value[k] % n != 0:
			print('NO')
			error = True
			break
	if not error:
		print('YES')


def check(n):
	d = {}
	for i in range(n):
		s = input()
		for el in s:
			if d.get(el) == None:
				d[el] = 1
			else:
				d[el] += 1
	for v in d.values():
		if v % n != 0:
			return 'NO'
	return 'YES'
n = int(input())
for i in range(n):
	print(check(int(input())))


num_of_packets = int(input())
output = []
for i in range(num_of_packets):
	num_of_inputs = int(input())
	inps = []
	letters = {}
	for j in range(num_of_inputs):
		inps.append(input())
	for j in inps:
		for k in j:
			if k in letters.keys():
				letters[k] += 1
			else:
				letters[k] = 1
	steps_output = 0
	for j in letters:
		if steps_output != -1:
			if letters[j] % num_of_inputs == 0:
				pass
			else:
				steps_output = -1
		else:
			break
	if steps_output == 0:
		output.append('YES')
	else:
		output.append('NO')
for i in output:
	print(i)


x = input()
for i in range(int(x)):
	n = input()
	counts = dict()
	for j in range(int(n)):
		z = input()
		for k in z:
			counts[k] = counts.get(k, 0) + 1
	p = 0
	for number in counts.values():
		if number % int(n) == 0:
			p = p
		else:
			p = p + 1
	if p == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		n = I()
		lis = [0 for i in range(26)]
		for i in range(n):
			s = input()
			for j in range(len(s)):
				lis[ord(s[j]) - 97] += 1
		flag = 1
		for i in range(26):
			if lis[i] % n != 0:
				flag = 0
				break
		if flag:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
while t != 0:
	n = int(input())
	l = []
	flag = 0
	for i in range(n):
		l.append(input())
	d = {}
	for s in l:
		ln = len(s)
		for i in range(ln):
			if not s[i] in d.keys():
				d[s[i]] = 1
			else:
				d[s[i]] += 1
	for i in d.values():
		if i % n != 0:
			print('NO')
			flag = 1
			break
	if flag != 1:
		print('YES')
	t = t - 1


T = int(input())
for _ in range(T):
	N = int(input())
	dic = {}
	flag = 0
	for i in range(N):
		A = input()
		for i in A:
			if i in dic:
				dic[i] += 1
			else:
				dic[i] = 1
	for i in dic:
		if dic[i] % N != 0:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	dic = {}
	for i in range(n):
		s = input()
		for i in s:
			if i in dic:
				dic[i] += 1
			else:
				dic[i] = 1
	arr = []
	for i in dic:
		arr.append(dic[i])
	flag = 0
	for i in arr:
		if i % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = defaultdict(int)
	for i in range(n):
		x = str(input())
		for j in x:
			a[j] += 1
	f = 0
	for i in a:
		if a[i] % n != 0:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(freq, f) = ([0] * 26, 0)
	n = int(input())
	for i in range(n):
		s = input()
		for i in s:
			freq[ord(i) - ord('a')] += 1
	(mn, mx) = (10000000, 0)
	for i in range(26):
		if freq[i] % n:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


for cases in range(int(input())):
	k = int(input())
	lst = []
	for m in range(k):
		string = list(input())
		lst = lst + string
	sett = set(lst)
	sett = list(sett)
	for i in range(len(sett)):
		if lst.count(sett[i]) % k == 0:
			if i == len(sett) - 1:
				print('YES')
				break
			continue
		else:
			print('NO')
			break


T = int(input())
for i in range(T):
	n = int(input())
	l = ''
	c = 0
	for j in range(n):
		a = input()
		l = l + a
		j = j + 1
	r = str(set(l))
	for k in range(len(r)):
		if l.count(r[k]) % n == 0:
			c = c + 1
		else:
			break
	if c == len(r):
		print('YES')
	else:
		print('NO')


import collections
for _ in range(int(input())):
	n = int(input())
	strings = []
	for i in range(n):
		strings.append(input())
	counter = collections.Counter(''.join(strings))
	for (letter, cnt) in counter.items():
		if cnt % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
from collections import Counter
for _ in range(t):
	n = int(input())
	c = Counter([])
	for i in range(n):
		x = input()
		for item in x:
			c[item] += 1
	flag = 0
	for item in c.keys():
		if c[item] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
		continue
	print('YES')


import math
import random
t = int(input())
while t:
	t -= 1
	a = [0 for i in range(30)]
	n = int(input())
	for i in range(n):
		s = input()
		for j in range(len(s)):
			a[ord(s[j]) - ord('a')] += 1
	tag = 1
	for i in range(26):
		if a[i] % n != 0:
			tag = 0
	if tag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	char_arr = [0] * 26
	for _ in range(n):
		s += input()
	for s_i in s:
		i = ord(s_i) - ord('a')
		char_arr[i] += 1
	flag = 1
	for i in char_arr:
		if i > 0 and i % n != 0:
			print('NO')
			flag = 0
			break
	if flag == 1:
		print('YES')


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for _ in range(t):
	(n,) = I()
	st = [0] * 26
	for i in range(n):
		s = input().strip()
		for j in s:
			st[ord(j) - 97] += 1
	an = 'YES'
	for i in range(26):
		if st[i] % n:
			an = 'NO'
			break
	print(an)


import sys
readline = sys.stdin.readline

def i1():
	return int(readline())

def s1():
	return readline().rstrip()

def sn(n):
	return [readline().rstrip() for i in range(n)]

def sm(n):
	return (readline().rstrip() for i in range(n))

def redir(s):
	global readline
	import os
	fn = sys.argv[0] + f'/../in-{s}.txt'
	readline = open(fn).readline if os.path.exists(fn) else readline
redir('a')
for _ in range(i1()):
	n = i1()
	cnt = {i: 0 for i in 'abcdefghijklmnopqrstuvwxyz'}
	for s in sm(n):
		for k in cnt:
			cnt[k] += s.count(k)
	cnt = set((i for i in cnt.values() if i != 0))
	minval = min(cnt)
	cond = (x % n == 0 for x in cnt)
	print('YES' if all(cond) == 1 else 'NO')


import sys
sys.setrecursionlimit(10000)
t = int(input())
for _ in range(t):
	n = int(input())
	s = []
	sed = False
	count = [0] * 26
	for _ in range(n):
		si = input()
		for letter in si:
			count[ord(letter) - 97] += 1
	for c in count:
		if c % n != 0:
			sed = True
	if sed is True:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	flag = 1
	for i in d:
		if d[i] % n != 0:
			flag = 0
			print('NO')
			break
	if flag:
		print('YES')


t = int(input())
fs = []
for i in range(t):
	sub = []
	n = int(input())
	for j in range(n):
		s = input()
		sub.append(s)
	fs.append(sub)
for i in fs:
	count = {}
	nstrings = len(i)
	for j in i:
		x = list(j)
		for k in x:
			if k in count.keys():
				count[k] = count[k] + 1
			else:
				count[k] = 1
	flag = 0
	for y in count.keys():
		if count[y] % nstrings == 0:
			continue
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


test = int(input())
ANS = []
for i in range(test):
	STR = ''
	ns = int(input())
	for j in range(ns):
		STR = STR + input()
	temp = 0
	count = 0
	alpha_count = []
	alpha_type = []
	for j in range(len(STR)):
		if STR[j] in alpha_type:
			temp = alpha_type.index(STR[j])
			alpha_count[temp] = alpha_count[temp] + 1
		else:
			alpha_type.append(STR[j])
			alpha_count.append(1)
	for j in range(len(alpha_count)):
		if alpha_count[j] % ns != 0:
			ANS.append('NO')
			break
		if alpha_count[j] % ns == 0 and j == len(alpha_count) - 1:
			ANS.append('YES')
for i in range(test):
	print(ANS[i])


t = int(input())
for i in range(t):
	n = int(input())
	A = []
	for i in range(n):
		S = list(input())
		for s in S:
			b = 0
			for a in A:
				if a[0] == s:
					a[1] += 1
					b = 1
			if b == 0:
				A.append([s, 1])
	ans = 'YES'
	for a in A:
		if a[1] % n != 0:
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	S = ''
	for _ in range(n):
		S += input()
	D = dict()
	for _ in S:
		if _ in D:
			D[_] += 1
		else:
			D[_] = 1
	for _ in D:
		if D[_] % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for you in range(t):
	n = int(input())
	freq = [0 for i in range(26)]
	for i in range(n):
		s = input()
		for x in s:
			freq[ord(x) - 97] += 1
	poss = 1
	for i in freq:
		if i % n:
			poss = 0
			break
	if poss:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = ''
	for _ in range(n):
		s += input()
	q = list(set(s))
	for i in q:
		if s.count(i) % n:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t:
	n = int(input())
	s = ''
	for i in range(0, n):
		s += str(input())
	s = sorted(s)
	c = True
	for i in range(ord(s[0]), ord(s[len(s) - 1]) + 1):
		if s.count(chr(i)) % n != 0:
			c = False
			break
	if c == True:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(0, int(input())):
	a = int(input())
	l = []
	k = []
	t = 0
	for i in range(0, a):
		c = input()
		for i in c:
			l.append(i)
	for i in set(l):
		k.append(l.count(i))
	for i in k:
		if i % a == 0:
			continue
		else:
			t = 1
			print('NO')
			break
	if t == 0:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	letters = {}
	for a in range(n):
		string = input()
		for letter in string:
			try:
				letters[letter] += 1
			except KeyError:
				letters[letter] = 1
	possible = True
	for (key, value) in letters.items():
		if value % n != 0:
			possible = False
	if possible:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = {}
	t = 0
	for i in range(n):
		s = input()
		for j in s:
			if j in a:
				a[j] += 1
			else:
				a[j] = 1
	for (k, v) in a.items():
		if v % n != 0:
			t += 1
			break
	if t > 0:
		print('NO')
	else:
		print('YES')


from collections import Counter
import math
t = int(input())
for _ in range(t):
	d = {}
	n = int(input())
	for i1 in range(n):
		s = input()
		for i in s:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	x = 0
	for j in d:
		if d[j] % n != 0:
			x = 1
			break
	if x == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	st = 'abcdefghijklmnopqrstuvwxyz'
	dic = {}
	for i in st:
		dic[i] = 0
	li = []
	for i in range(n):
		li.append(input())
	for i in li:
		for j in i:
			dic[j] += 1
	flag = True
	for i in dic:
		if dic[i] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


def find_ans(n):
	a = {}
	for i in range(n):
		s = input()
		for j in s:
			a[j] = a.get(j, 0) + 1
	for i in a:
		if a[i] % n != 0:
			return False
	return True
for _ in range(int(input())):
	n = int(input())
	if find_ans(n):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	d = {}
	n = int(input())
	for i in range(n):
		arr = list(input())
		for i in arr:
			d[i] = d.get(i, 0) + 1
	flag = 0
	for i in d:
		if d[i] % n != 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


def main():
	words = list()
	for _ in range(int(input())):
		words.append(input().strip().lower())
	table = [0] * 26
	for word in words:
		for char in word:
			table[ord(char) - ord('a')] += 1
	for charCount in table:
		if charCount % len(words) != 0:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = [0] * 26
	flag = 0
	for i in range(n):
		l = input()
		u = sorted(l)
		l = ''.join(u)
		j = 0
		k = len(l)
		while j < k:
			m = l.count(l[j])
			a[ord(l[j]) - 97] += m
			j += m
	for i in a:
		if i % n == 0:
			continue
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	n = int(input())
	c = dict()
	for _ in range(n):
		s = input()
		for h in s:
			if h in c:
				c[h] += 1
			else:
				c[h] = 1
	ans = True
	for h in c:
		if c[h] % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


for k in range(int(input(''))):
	l = []
	chl = []
	n = int(input(''))
	for x in range(n):
		l += list(input(''))
	for i in l:
		if i not in chl:
			chl.append(i)
			if l.count(i) % n != 0:
				print('NO')
				break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	ch = {}
	for i in range(n):
		s = input()
		for c in s:
			if c in ch:
				ch[c] += 1
			else:
				ch[c] = 1
	f = True
	for c in ch:
		if ch[c] % n != 0:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		st = input()
		s = s + st
	l = list(s)
	se = set(l)
	d = {}
	for i in se:
		d[i] = 0
	for i in l:
		d[i] = d[i] + 1
	lm = list(d.values())
	pr = 1
	for i in lm:
		if i % n == 0:
			pr = pr * 1
		else:
			pr = pr * 0
	if pr == 1:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	f = 0
	c = [0 for i in range(26)]
	l = 0
	for i in range(n):
		s = input()
		l += len(s)
		for i in s:
			c[ord(i) - ord('a')] += 1
	for j in c:
		if j % n != 0:
			f = 1
			break
	if l % n != 0:
		f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = []
	for i in range(n):
		s.append(input())
	total_counter = Counter()
	for e in s:
		total_counter += Counter(e)
	f = 1
	for v in total_counter.values():
		if v % n != 0:
			print('NO')
			f = 0
			break
	if f:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = []
	b = [0] * 26
	s = 0
	for i in range(n):
		a.append(input())
		s += len(a[i])
		for j in a[i]:
			b[ord(j) - 97] += 1
	found = False
	for i in b:
		if i % n != 0:
			print('NO')
			found = True
			break
	if not found:
		print('YES')


for _ in range(int(input())):
	a = {}
	n = int(input())
	for i in range(n):
		for key in input():
			a[key] = a.get(key, 0) + 1
	for key in a:
		if a[key] % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	ss = [0] * 26
	flag = 0
	for i in range(n):
		a = input()
		for j in a:
			ss[ord(j) - 97] += 1
	for i in ss:
		if i % n:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


import math
import itertools

def check(str, n):
	i = 0
	str = sorted(str)
	while i < len(str):
		count = 1
		while i < len(str) - 1 and str[i] == str[i + 1]:
			i += 1
			count += 1
		if count % n != 0:
			return False
		i += 1
	return True
t = int(input())
for _ in range(t):
	s = ''
	n = int(input())
	for i in range(n):
		inp = input()
		s += inp
	if check(s, n):
		print('YES')
	else:
		print('NO')
	check(s, n)


t = int(input())
for tc in range(t):
	n = int(input())
	dic = dict()
	s = ''
	for j in range(n):
		s = input()
		for i in s:
			if i not in dic.keys():
				dic[i] = 1
			else:
				dic[i] += 1
	val = dic.values()
	for i in val:
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	c = Counter()
	for _ in range(n):
		c += Counter(input())
	ans = 'YES'
	for i in c:
		if c[i] % n != 0:
			ans = 'NO'
			break
	print(ans)


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	ansString = ''
	for i in range(n):
		string = input()
		ansString += string
	freqDict = dict(Counter(ansString))
	values = list(freqDict.values())
	ok = 'YES'
	for val in values:
		if val % n != 0:
			ok = 'NO'
			break
	print(ok)


for _ in range(int(input())):
	n_str = int(input())
	tot = []
	for i in range(n_str):
		s = input().strip()
		x = list(s)
		tot.extend(x)
	my_set = set(tot)
	count = 0
	for letter in my_set:
		if tot.count(letter) % n_str == 0:
			count += 1
		else:
			print('NO')
			break
	if count == len(my_set):
		print('YES')


t = int(input())
for i in range(t):
	k = int(input())
	l = []
	for i in range(k):
		l += input()
	s = set(l)
	flag = 1
	for j in s:
		if l.count(j) % k != 0:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	for _ in range(n):
		s += input()
	possible = 1
	unique_letters = set(s)
	for letter in unique_letters:
		if s.count(letter) % n != 0:
			print('NO')
			possible = 0
			break
	if possible == 1:
		print('YES')


def check(d, n):
	for c in d.keys():
		if d[c] % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	d = dict()
	for j in range(n):
		s = input()
		for c in s:
			if c not in d.keys():
				d[c] = 1
			else:
				d[c] += 1
	print(check(d, n))


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = []
	for i in range(n):
		l1 += list(input())
	ruined = 0
	for j in list(set(l1)):
		if l1.count(j) % n:
			ruined = 1
			break
	if ruined:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	l = []
	l1 = [0] * 26
	for j in range(n):
		s = input()
		for k in s:
			l1[ord(k) - 97] += 1
	ans = 'YES'
	for j in l1:
		if j % n:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	c = 0
	L = [0 for i in range(26)]
	for __ in range(n):
		s = input()
		for i in s:
			L[ord(i) - 97] = L[ord(i) - 97] + 1
	for i in L:
		if i % n != 0:
			c = c + 1
			print('NO')
			break
	if c == 0:
		print('YES')


t = int(input())
for T in range(t):
	n = int(input())
	ct = [0 for i in range(26)]
	for i in range(n):
		lin = input()
		for k in lin:
			ct[ord(k) - 97] += 1
	f = 0
	for i in ct:
		if i % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter

def solve(strings, n):
	abc = Counter(strings)
	if [val for val in abc.values() if val % n != 0]:
		return 'NO'
	else:
		return 'YES'
tc = int(input())
for i in range(tc):
	n = int(input())
	strings = ''.join([input() for i in range(n)])
	print(solve(strings, n))


for x in range(int(input())):
	n = int(input())
	i = 0
	b = []
	while i < n:
		a = input()
		a = list(a)
		b += a
		i += 1
	b.sort()
	i = 0
	freq = {}
	for y in b:
		if y in freq:
			freq[y] += 1
		else:
			freq[y] = 1
	ans = 0
	for y in freq:
		if ans != 1:
			if freq[y] % n == 0:
				ans = 0
			else:
				ans = 1
	if ans == 0:
		print('YES')
	else:
		print('NO')


testCases = []
testNums = []
for i in range(int(input())):
	arr = ''
	lenghtOfTest = int(input())
	for j in range(lenghtOfTest):
		arr += input()
	testCases.append(arr)
	testNums.append(lenghtOfTest)

def indexLen(arr, che):
	lenght = 0
	for i in arr:
		if i == che:
			lenght += 1
	return lenght

def juggle(arrOf, testCasesNum):
	alreadySeen = []
	nums = []
	for i in arrOf:
		if i not in alreadySeen:
			if indexLen(arrOf, i) % testCasesNum != 0:
				return 'NO'
		alreadySeen.append(i)
	return 'YES'
for i in range(len(testCases)):
	print(juggle(testCases[i], testNums[i]))


from collections import Counter

def main():
	t = int(input())
	while t > 0:
		n = int(input())
		chk = n
		strt = ''
		while n > 0:
			inp = input()
			strt = strt + inp
			n -= 1
		strt = Counter(strt)
		found = 1
		for (key, value) in strt.items():
			value = int(value)
			if value % chk != 0:
				found = 0
				break
		if found == 1:
			print('YES')
		else:
			print('NO')
		t -= 1
main()


def process(l, p):
	d = dict()
	for item in l:
		g = list(item)
		for i in g:
			if i in d.keys():
				d[i] = d[i] + 1
			else:
				d[i] = 1
	for i in d:
		if d[i] % p != 0:
			print('NO')
			return
	print('YES')

def main():
	t = int(input())
	k = list()
	while t > 0:
		k.clear()
		n = int(input())
		for i in range(0, n):
			k.append(input())
		process(k, n)
		t -= 1
main()


t = int(input())
for i in range(t):
	n = int(input())
	ss = ''
	for i in range(n):
		s = input()
		ss += s
	chars = list(ss)
	Numbers = []
	for j in chars:
		Numbers.append(ss.count(j))
	Flag = False
	for i in Numbers:
		if i % n != 0:
			Flag = True
			print('NO')
			break
	if Flag == False:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = {}
	no = False
	for _ in range(n):
		for c in input():
			if c not in s:
				s[c] = 1
			else:
				s[c] += 1
	for key in s:
		if s[key] % n != 0:
			no = True
			break
	if no:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	al = '-abcdefghijklmnopqrstuvwxyz'
	l = [0] * 27
	a = ''
	for i in range(n):
		s = input()
		a = a + s
	for i in a:
		if i in al:
			l[al.index(i)] += 1
	m = []
	for i in l:
		if i != 0:
			m.append(i)
	ans = 'YES'
	for k in m:
		if k % n != 0:
			ans = 'NO'
	print(ans)


import sys
T = int(sys.stdin.readline())
for i in range(T):
	N = int(sys.stdin.readline())
	string = ''
	for j in range(N):
		string += str(sys.stdin.readline().strip())
	for k in set(string):
		if string.count(k) % N != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	count = [0] * 100
	for i in range(0, n):
		s = input()
		for char in s:
			count[ord(char) - ord('a')] += 1
	if any((val % n > 0 for val in count)):
		print('NO')
	else:
		print('YES')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	d = {}
	arr = []
	for i in range(n):
		s = str(input())
		for j in range(len(s)):
			if s[j] not in d:
				d[s[j]] = 1
			else:
				d[s[j]] += 1
	for i in d:
		if d[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


from itertools import groupby
t = int(input())
A = []
for i in range(t):
	C = 0
	B = []
	n = int(input())
	for j in range(n):
		s = input()
		for k in s:
			B.append(k)
	B = sorted(B)
	p = [len(list(group)) for (key, group) in groupby(B)]
	for l in range(len(p)):
		if p[l] % n == 0:
			C += 1
	if C == len(p):
		A.append('YES')
	else:
		A.append('NO')
for i in A:
	print(i)


def fun():
	count = int(input())
	data = ''
	for i in range(count):
		data += input()
	data = list(data)
	symbols = list(set(data))
	for s in symbols:
		if data.count(s) % count == 0:
			continue
		else:
			print('NO')
			return
	print('YES')
for t in range(int(input())):
	fun()


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	S = ''
	for __ in range(n):
		S += input()
	count = Counter(S)
	k = 0
	for i in set(S):
		if count[i] % n:
			k = 1
			break
	if k:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	res = [s.count(i) % n for i in set(s)]
	print('YES' if set(res) == {0} else 'NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = ''
	for i in range(n):
		l = l + input()
	res = Counter(l)
	f = 1
	for i in res:
		if res[i] % n != 0:
			f = 0
			break
	if f == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = []
	for i in range(n):
		l.append(input())
	s = ''
	for i in range(n):
		s += l[i]
	hashes = [0] * 26
	for i in s:
		hashes[ord(i) - 97] += 1
	flag = 0
	for i in hashes:
		if i % n == 0:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


def solution():
	n = int(input())
	test_string = ''
	freq = {}
	for i in range(n):
		test_string = test_string + input()
	for i in test_string:
		if i in freq:
			freq[i] += 1
		else:
			freq[i] = 1
	for elem in freq.values():
		if not elem % n == 0:
			return 'NO'
	return 'YES'
cases = int(input())
for i in range(cases):
	print(solution())


from sys import *
for testcases in range(int(input())):
	num = int(input())
	l = [0] * 26
	for i in range(num):
		c = stdin.readline().strip()
		for chars in c:
			l[ord(chars) - 97] += 1
	flag = 1
	for elem in l:
		if elem % num != 0:
			print('NO')
			flag = 0
			break
	if flag == 1:
		print('YES')


r = []
for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		for j in input():
			if d.get(j):
				d[j] += 1
			else:
				d[j] = 1
	ist = True
	for i in set(d.values()):
		if i / n % 1 != 0:
			ist = False
	if ist:
		r.append('YES')
	else:
		r.append('NO')
print('\n'.join(r))


from collections import Counter
for _ in range(int(input())):
	a = int(input())
	ans = ''
	for _ in range(a):
		ans += input()
	q = Counter(ans)
	k = list(filter(lambda x: x % a != 0, q.values()))
	if k == []:
		print('YES')
	else:
		print('NO')


for j in range(int(input())):
	n = int(input())
	a = ''
	for i in range(n):
		a = a + input()
	b = set(list(a))
	c = 0
	for i in ''.join(b):
		if a.count(i) % n == 0:
			pass
		else:
			c = 1
	if c == 1:
		print('NO')
	else:
		print('YES')


import sys
from sys import setrecursionlimit
from collections import defaultdict
setrecursionlimit(10 ** 5)
readline = sys.stdin.readline

def process():
	n = int(readline().strip())
	str_list = []
	for _ in range(n):
		str_list.append(readline().strip())
	hash_table = defaultdict(int)
	for string in str_list:
		for i in string:
			hash_table[i] += 1
	for val in hash_table.values():
		if val % n != 0:
			print('NO')
			return
	print('YES')
for _ in range(int(readline())):
	process()


t = int(input())
for i2 in range(t):
	n = int(input())
	b = [0] * 26
	flag = True
	for i in range(n):
		for j in input():
			b[ord(j) - ord('a')] += 1
	for i in b:
		if i % n != 0:
			flag = False
			break
	if flag == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(input())
	f = [0 for i in range(26)]
	diff = ord('a')
	for string in l:
		for i in string:
			f[ord(i) - diff] += 1
	possible = True
	for i in range(26):
		if f[i] % n != 0:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')


import collections
for _ in range(int(input())):
	n = int(input())
	s = [input() for _ in range(n)]
	d = collections.Counter()
	for x in s:
		d.update(x)
	f = 0
	for i in d.values():
		if i % n != 0:
			f = 1
			break
	print('YES' if f == 0 else 'NO')


def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			print(p)
t = int(input())
for _ in range(t):
	n = int(input())
	l = [0] * 26
	s1 = ''
	for i in range(n):
		s = input()
		s1 = s1 + s
	for i in s1:
		l[ord(i) - 97] += 1
	f = 1
	for i in l:
		if i % n != 0:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [input() for i in range(n)]
	d = dict()
	f = True
	for i in range(n):
		for s in a[i]:
			if s not in d.keys():
				d[s] = 1
			else:
				d[s] += 1
	for v in d.values():
		if v % n != 0:
			f = False
	if f:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	hash = defaultdict(int)
	for i in range(n):
		s = input()
		for i in s:
			hash[i] += 1
	flag = 0
	for i in hash:
		if hash[i] % n != 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	m = int(input())
	line = ''
	for i in range(m):
		line += input()
	f = {}
	for i in line:
		f[i] = f.get(i, 0) + 1
	if all((value % m == 0 for value in f.values())) == True:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = ''
	ans = 0
	for i in range(n):
		s = str(input())
		a += s
	for i in range(len(a)):
		if a.count(a[i]) % n != 0:
			print('NO')
			ans = 1
			break
	if ans == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = ''
	for _ in range(n):
		s += input()
	d = {}
	for e in s:
		val = d.get(e, None)
		if val is None:
			d[e] = 1
		else:
			d[e] += 1
	flag = True
	for (k, v) in d.items():
		if v % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


def main() -> None:
	for _ in range(int(input())):
		n = int(input())
		cnt = [0 for i in range(26)]
		for _ in range(n):
			s = input()
			for i in s:
				cnt[ord(i) - 97] += 1
		ans = True
		for i in range(26):
			if cnt[i] % n != 0:
				ans = False
				break
		if ans:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for tc in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s = s + input()
	li = []
	for i in s:
		li.append(s.count(i))
	for i in li:
		if i % n != 0:
			p = 'NO'
			break
		else:
			p = 'YES'
	print(p)


import os
import sys, math
from io import BytesIO, IOBase

def main():
	t = int(input())
	for case in range(t):
		n = int(input())
		dp = [0 for i in range(26)]
		for i in range(n):
			s = input()
			for j in range(len(s)):
				dp[ord(s[j]) - ord('a')] += 1
		ans = True
		for i in range(26):
			if dp[i] % n != 0:
				ans = False
		print('YES') if ans else print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	n = int(input())
	l = [0] * 257
	for i in range(n):
		a = input()
		for i in a:
			l[ord(i)] += 1
	ans = 1
	for i in range(257):
		if l[i] % n != 0:
			ans = 0
			break
	if ans == 1:
		print('YES')
	else:
		print('NO')


import sys

def solve():
	dp = [0] * 26
	n = sys.stdin.readline().rstrip('\n')
	n = int(n)
	search = ''
	for i in range(n):
		search += sys.stdin.readline().rstrip('\n')
	for x in search:
		dp[ord(x) - ord('a')] += 1
	for x in dp:
		if x % n != 0:
			print('NO')
			return
	print('YES')
T = int(sys.stdin.readline().rstrip('\n'))
for i in range(T):
	solve()


import collections
for i in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		t = input()
		s = s + t
	s = list(s)
	ok = 0
	a = collections.Counter(s)
	ans = list(a.values())
	for i in range(len(ans)):
		if ans[i] % n != 0:
			ok = 1
			break
	if ok == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	let = {}
	for __ in range(n):
		s = input()
		for char in s:
			let[char] = let.get(char, 0) + 1
	for (key, value) in let.items():
		if value % n != 0:
			print('NO')
			break
	else:
		print('YES')


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def ok():
	for c in cnt:
		if c % n:
			return False
	return True
for _ in range(II()):
	n = II()
	cnt = [0] * 26
	for _ in range(n):
		for c in SI():
			cnt[ord(c) - 97] += 1
	if ok():
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	j = []
	for i in range(n):
		j.append(input())
	s = ''.join(j)
	d = {}
	for i in s:
		if i not in d.keys():
			d[i] = 1
		else:
			d[i] += 1
	if all((d[i] % n == 0 for i in d.keys())):
		print('YES')
	else:
		print('NO')
	t -= 1


t = input()
t = int(t)
while t > 0:
	n = input()
	n = int(n)
	ss = ''
	for i in range(n):
		s = input()
		ss += s
	count = 0
	for c in set(ss):
		if ss.count(c) % n == 0:
			count += 1
		else:
			break
	if count == len(set(ss)):
		print('YES')
	else:
		print('NO')
	t -= 1


from collections import Counter
for _ in range(int(input())):
	a = ''
	n = int(input())
	for _ in range(n):
		s = input()
		a += s
	k = Counter(a)
	b = list(k.values())
	cnt = 0
	for i in b:
		if i % n == 0:
			cnt += 1
	if cnt == len(b):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	counter = dict()
	n = int(input())
	num = 0
	for j in range(n):
		s = input()
		for k in s:
			if k in counter:
				counter[k] += 1
			else:
				counter[k] = 1
	if any((k for k in counter.values() if k % n != 0)):
		print('NO')
	else:
		print('YES')


for j in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(input())
	st = ''.join(l)
	str = ''.join(sorted(st))
	flag = 0
	if len(str) % n != 0:
		print('NO')
	else:
		all_freq = {}
		for i in str:
			if i in all_freq:
				all_freq[i] += 1
			else:
				all_freq[i] = 1
		for (key, value) in all_freq.items():
			if value % n != 0:
				flag = 1
		if flag == 0:
			print('YES')
		else:
			print('NO')


t = int(input())
answer = []
for test in range(t):
	n = int(input())
	char = [0 for i in range(26)]
	for i in range(n):
		string = input()
		for j in range(len(string)):
			char[ord(string[j]) - 97] = (char[ord(string[j]) - 97] + 1) % n
	if char != [0 for i in range(26)]:
		answer.append('NO')
	else:
		answer.append('YES')
print('\n'.join(answer))


def func():
	n = int(input())
	c = {}
	for i in range(n):
		s = input()
		for ch in s:
			if ch not in c:
				c[ch] = 0
			c[ch] += 1
	for key in c:
		if c[key] % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	print(func())


t = int(input())
out = []
for i in range(t):
	n = int(input())
	cnt = dict()
	for j in range(n):
		s = input()
		for k in s:
			if k in cnt.keys():
				cnt[k] += 1
			else:
				cnt[k] = 1
	ans = 'YES'
	for k in cnt.values():
		if k % n != 0:
			ans = 'NO'
			break
	out.append(ans)
print('\n'.join(out))


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
t = int(input())
for tt in range(t):
	n = int(input())
	l = [0] * 26
	for i in range(n):
		s = input()
		for si in s:
			l[ord(si) - ord('a')] += 1
	f = int(1)
	for i in range(26):
		if l[i] % n != 0:
			f = 0
	if f == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	x = int(input())
	rd = dict()
	for i in range(x):
		f = input().rstrip()
		for j in f:
			if j in rd:
				rd[j] += 1
			else:
				rd[j] = 1
	for i in rd:
		if rd[i] % x != 0:
			print('NO')
			break
	else:
		print('YES')


def juggling_letters(n, strings):
	char_count = {}
	for string in strings:
		for char in string:
			if char in char_count:
				char_count[char] += 1
			else:
				char_count[char] = 1
	for char in char_count:
		if char_count[char] % n != 0:
			return 'NO'
	return 'YES'
T = int(input())
for i in range(T):
	strings = []
	n = int(input())
	for i in range(n):
		strings.append(input())
	print(juggling_letters(n, strings))


testcases = int(input())
for i in range(testcases):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	unique = list(set(s))
	for i in unique:
		if s.count(i) % n == 0:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
t = int(input())
for s in range(t):
	n = int(input())
	ans = defaultdict(int)
	for j in range(n):
		vals = [k for k in input()]
		for i in vals:
			ans[i] += 1
	ok = True
	for s in ans.keys():
		if ans[s] % n != 0:
			ok = False
			break
	if ok == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	l = dict()
	c = 0
	n = int(input())
	for _ in range(n):
		s = input()
		for i in s:
			if i in l:
				l[i] += 1
			else:
				l[i] = 1
	for i in l:
		if l[i] % n != 0:
			c = 1
			print('NO')
			break
	if c == 0:
		print('YES')


from fractions import Fraction
import bisect
import os
import io
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
from queue import Queue

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(iinput()):
	n = iinput()
	st = []
	for i in range(n):
		st.append(input())
	d = defaultdict(int)
	for i in st:
		for j in i:
			d[j] += 1
	flg = True
	for i in d:
		if d[i] % n != 0:
			flg = False
			break
	print('YES' if flg else 'NO')


T = int(input())
lets = 'abcdefghijklmnopqrstuvwxyz'
key = {lets[i]: i for i in range(26)}
for t in range(T):
	d = False
	a = [0] * 26
	n = int(input())
	for i in range(n):
		for i in input():
			a[key[i]] += 1
	for i in a:
		if i % n != 0:
			print('NO')
			d = True
			break
	if not d:
		print('YES')


tc = int(input())
for i in range(tc):
	n = int(input())
	dict = {}
	for j in range(n):
		for k in input():
			if k in dict.keys():
				dict[k] += 1
			else:
				dict[k] = 1
	for j in dict:
		if dict[j] % n != 0:
			print('NO')
			n = -1
	if n != -1:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	chars = {}
	for i in range(n):
		s = input()
		for j in range(len(s)):
			char = s[j]
			if not char in chars:
				chars[char] = 1
			else:
				chars[char] += 1
	f = 0
	for key in chars:
		if chars[key] % n != 0:
			f = 1
	if f == 0:
		print('YES')
	else:
		print('NO')


tests = int(input())
for test in range(tests):
	n = int(input())
	cnt = [0] * 26
	for i in range(n):
		s = input()
		for ch in s:
			cnt[ord(ch) - ord('a')] += 1
	can = True
	for c in cnt:
		if c % n != 0:
			can = False
			break
	print('YES' if can else 'NO')


for _ in range(int(input())):
	n = int(input())
	d = dict()
	for i in range(n):
		s = input().strip()
		for i in s:
			d[i] = d.get(i, 0) + 1
	print(('NO', 'YES')[all((d[i] % n == 0 for i in d))])


n = int(input())
for i in range(n):
	lst = []
	m = 0
	n1 = int(input())
	for j in range(n1):
		n2 = input()
		for z in n2:
			lst.append(z)
	s = set(lst)
	for k in s:
		if lst.count(k) % n1 == 0:
			m = m + 1
	if m == len(s):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	p = int(input())
	l = []
	for j in range(p):
		s1 = input()
		l.append(s1)
	s2 = ''.join(l)
	for j in s2:
		if s2.count(j) % p != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for case in range(t):
	n = int(input())
	ans = True
	alphapet = [0] * 26
	for line in range(n):
		string = input()
		for i in string:
			alphapet[ord(i) - 97] += 1
	for i in alphapet:
		if i % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	d = {}
	for x in range(n):
		s = input()
		for y in s:
			if y in d:
				d[y] += 1
			else:
				d[y] = 1
	flag = 0
	for z in d:
		if d[z] % n != 0:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	(myStr, n) = ('', int(input()))
	for i in range(n):
		myStr += input()
	(ans, temp) = (Counter(myStr), 0)
	for i in ans.keys():
		if ans[i] / n != ans[i] // n:
			temp = 1
			print('NO')
			break
	if temp == 0:
		print('YES')


def solve():
	d = dict()
	l = list()
	j = 0
	c = int(input())
	for u in range(c):
		a = input()
		for i in a:
			if i in d.keys():
				l[d[i]] += 1
			else:
				d[i] = j
				l.append(1)
				j += 1
	for i in d.keys():
		if l[d[i]] % c != 0:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	a = ''
	for i in range(n):
		a += input()
	d = list(set(a))
	c = 0
	for i in range(len(d)):
		if a.count(d[i]) % n == 0 and i < len(d):
			c += 1
			continue
		else:
			print('NO')
			break
	if c == len(d):
		print('YES')


T = int(input())
for _ in range(T):
	n = int(input())
	alpha_dic = {}
	for _ in range(n):
		string = input()
		for c in string:
			if c in alpha_dic:
				alpha_dic[c] += 1
			else:
				alpha_dic[c] = 1
	flag = True
	for key in alpha_dic.keys():
		if alpha_dic[key] % n != 0:
			flag = False
			print('NO')
			break
	if flag:
		print('YES')


t = int(input())
for o in range(t):
	n = int(input())
	m = []
	for i in range(n):
		g = list(input())
		m.append(g)
	a = [0] * 26
	for i in range(n):
		for j in range(len(m[i])):
			a[ord(m[i][j]) - 97] += 1
	f = 0
	for i in range(26):
		if a[i] % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	dict1 = defaultdict(int)
	for i in range(n):
		s = input()
		for j in s:
			dict1[j] += 1
	nk = 0
	for i in dict1:
		if dict1[i] % n != 0:
			nk = 1
			print('NO')
			break
	if nk == 0:
		print('YES')


def abc(d, n):
	for j in d:
		if d[j] % n:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			try:
				d[j] += 1
			except:
				d[j] = 1
	print(abc(d, n))


T = int(input())
ans = []
for t in range(T):
	N = int(input())
	dic = {}
	for i in range(N):
		s = list(input())
		for j in range(len(s)):
			if s[j] in dic:
				dic[s[j]] += 1
			else:
				dic[s[j]] = 1
	ok = True
	for i in dic:
		if dic[i] % N != 0:
			ok = False
	ans.append('YES' if ok else 'NO')
for i in range(T):
	print(ans[i])


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
for _ in range(inn()):
	n = inn()
	d = defaultdict(int)
	for i in range(n):
		s = [str(x) for x in input()]
		for j in s:
			d[j] += 1
	ans = 'YES'
	for i in d:
		if d[i] % n != 0:
			ans = 'NO'
			break
	print(ans)


for t in range(int(input())):
	n = int(input())
	d = {}
	mat = []
	for i in range(n):
		s = input()
		mat.append(s)
	for lst in mat:
		for i in lst:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	flag = 0
	for i in d:
		if d[i] % n == 0:
			continue
		else:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	dic = {}
	for i in range(n):
		s = input()
		for j in s:
			if j in dic:
				dic[j] += 1
			else:
				dic[j] = 1
	fl = True
	for i in dic:
		if dic[i] % n != 0:
			fl = False
			break
	print('YES' if fl else 'NO')


import sys
import math
input = sys.stdin.readline

def solve():
	n = int(input())
	rows = []
	counter = {}
	total_len = 0
	for i in range(n):
		row = input().strip()
		total_len += len(row)
		for c in row:
			if c in counter:
				counter[c] += 1
			else:
				counter[c] = 1
		expected_count = total_len // len(counter)
	for count in counter.values():
		if count % n != 0:
			print('NO')
			return
	print('YES')
T = int(input())
for t in range(T):
	solve()


t = int(input())
for T in range(t):
	n = int(input())
	l = []
	d = {}
	s = 0
	for N in range(n):
		st = input()
		s = s + len(st)
		l.append(st)
		for i in st:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	f = 0
	for j in d.values():
		if j % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
import math

def main():
	for _ in range(int(input())):
		n = int(input())
		l = [list(input()) for i in range(n)]
		d = defaultdict(lambda : 0)
		for i in l:
			for j in i:
				d[j] += 1
		flag = True
		for i in d:
			if d[i] % n != 0:
				flag = False
				break
		if flag:
			print('YES')
		else:
			print('NO')
main()


from collections import Counter

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		strCounter = Counter()
		for i in range(n):
			s = input()
			temp = Counter(s)
			strCounter += temp
		flag = True
		for ele in strCounter:
			if strCounter[ele] % n != 0:
				print('NO')
				flag = False
				break
		if flag:
			print('YES')
main()


for _ in range(int(input())):
	char = dict()
	n = int(input())
	for __ in range(n):
		s = input()
		for c in s:
			char[c] = char.get(c, 0) + 1
	j = None
	for c in char:
		if char[c] % n != 0:
			print('NO')
			j = True
			break
	if j != True:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	temp = ''
	for i in range(n):
		s = input()
		temp += s
	d = Counter(temp)
	flag = 0
	for i in d:
		if d[i] % n == 0:
			flag = 0
		else:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	for j in range(n):
		s += str(input())
	s = list(s)
	se = set(s)
	for i in se:
		if s.count(i) % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import OrderedDict
t = int(input())
for i in range(0, t):
	n = int(input())
	s = ''
	flag = 0
	for j in range(0, n):
		s = s + input()
	a = set(s)
	a = ''.join(a)
	for ch in a:
		s.count(ch)
		if s.count(ch) % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = ''
	for i in range(n):
		s = input()
		a += s
	flag = True
	for i in range(len(a)):
		if a.count(a[i]) % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = [list(input()) for i in range(n)]
	l = []
	t = True
	for i in s:
		l += i
	j = Counter(l)
	for i in j:
		if j[i] % n == 0:
			continue
		else:
			print('NO')
			t = False
			break
	if t:
		print('YES')


k = int(input())
while k > 0:
	f = [0] * 26
	flag = 0
	n = int(input())
	t = n
	while t > 0:
		s = input()
		for i in range(len(s)):
			f[ord(s[i]) - ord('a')] += 1
		t -= 1
	for j in range(len(f)):
		if f[j] != 0 and f[j] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
	k -= 1


for i in range(int(input())):
	n = int(input())
	w = []
	for j in range(n):
		t = input()
		for c in t:
			b = w.count(c)
			if b == 0:
				w.append(c)
				w.append(1)
			else:
				w[w.index(c) + 1] += 1
	d = False
	for j in range(len(w)):
		if not j % 2 == 0:
			if not int(w[j]) % n == 0:
				print('NO')
				d = True
				break
	if not d:
		print('YES')


T = int(input())
for t in range(1, T + 1):
	N = int(input())
	mat = []
	for i in range(N):
		mat.append(input())
	ind = 1
	for i in range(N):
		for j in range(len(mat[i])):
			cnt = 0
			for k in range(N):
				for l in range(len(mat[k])):
					if mat[i][j] == mat[k][l]:
						cnt += 1
			if cnt % N != 0:
				ind = 0
				break
		if not ind:
			break
	if ind:
		print('YES')
	else:
		print('NO')


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions
from collections import deque, defaultdict, OrderedDict
from fractions import Fraction
from decimal import Decimal

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		n = ri()
		d = {}
		for j in range(n):
			k = rs()
			for i in k:
				if i in d:
					d[i] += 1
				else:
					d[i] = 1
		ans = 'YES'
		for i in d:
			if d[i] % n != 0:
				ans = 'NO'
		print(ans)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


for t in range(int(input())):
	s = ''
	n = int(input())
	for i in range(n):
		s += input()
	l = list(s)
	a = list(set(l))
	f = 0
	for i in a:
		if l.count(i) % n == 0:
			f = 1
		else:
			f = 0
			break
	if f == 1:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	txt = ''
	char = defaultdict(lambda : 0)
	for i in range(n):
		txt += input()
	for t in txt:
		char[t] += 1
	for value in char.values():
		if value % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import *
I = input
exec(int(I()) * "n=int(I());c=Counter(''.join(I()for _ in[0]*n));print('YNEOS'[any(c[x]%n for x in c)::2]);")


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	count = Counter()
	for _ in range(n):
		s = input()
		count.update(s)
	for i in count:
		if count[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	s = ''
	n = int(input())
	flag = 1
	for j in range(n):
		s += input()
		li = list(set(s))
	for x in li:
		if s.count(x) % n != 0:
			flag = 0
			break
	print('YES') if flag == 1 else print('NO')


t = int(input(''))
for i in range(t):
	n = int(input(''))
	dit = {}
	for i in range(n):
		s = input('')
		for i in range(len(s)):
			if s[i] not in dit.keys():
				dit[s[i]] = 1
			else:
				dit[s[i]] += 1
	ans = 'YES'
	for k in dit.keys():
		if dit[k] % n != 0:
			ans = 'NO'
			break
	print(ans)


t = int(input())
I = 0
while I < t:
	n = int(input())
	j = 0
	bukva = []
	Q = []
	valid = 0
	stroka = ''
	while j < n:
		stroka += str(input())
		j += 1
	for i in stroka:
		if i not in bukva:
			bukva.append(i)
			a = stroka.count(i)
			Q.append(a)
	for i in Q:
		if i % n != 0:
			valid = 1
	if valid == 1:
		print('NO')
	else:
		print('YES')
	I += 1


def dic():
	dict = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
	return dict
game = int(input())
for i in range(game):
	n = int(input())
	str = ''
	for i in range(n):
		strin = input()
		str = str + strin
		l = list(str)
	dict = dic()
	for char in l:
		dict[char] += 1
	a = 0
	for value in l:
		if dict[value] % n == 0:
			a += 1
		else:
			break
	if a == len(l):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	s = ''
	dic = {}
	ok = True
	n = int(input())
	for i in range(n):
		s += input()
	for j in range(len(s)):
		if s.count(s[j]) % n != 0:
			ok = False
			break
	if ok == True:
		print('YES')
	else:
		print('NO')


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	n = II()
	d = [0] * 26
	for i in range(n):
		for j in input():
			d[ord(j) - 97] += 1
	boo = True
	for i in d:
		if i % n != 0:
			boo = False
			break
	print('YES' if boo else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	dic = dict()
	flag = 0
	for i in range(n):
		string = input()
		for i in range(len(string)):
			if string[i] in dic:
				dic[string[i]] += 1
			else:
				dic[string[i]] = 1
	for i in dic:
		if dic[i] % n != 0:
			flag = 1
			print('NO')
			break
	if flag != 1:
		print('YES')


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	f = defaultdict(int)
	for i in range(n):
		s = input()
		l.append(s)
		for i in s:
			f[i] += 1
	a = 0
	for i in f:
		if f[i] % n != 0:
			a = 1
			break
	if a == 1:
		print('NO')
	else:
		print('YES')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import Counter
import heapq
for _ in range(int(input())):
	n = int(input())
	ls = [0] * 26
	for i in range(n):
		s = input()
		for j in s:
			ls[ord(j) - 97] += 1
	f = 0
	for k in range(26):
		if ls[k] % n != 0:
			f = 1
			break
	print('YES' if f == 0 else 'NO')


from sys import stdin
from math import ceil, gcd

def func():
	return
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	d = {}
	for i in range(n):
		s = stdin.readline().strip()
		for ele in s:
			d[ele] = d.get(ele, 0) + 1
	cond = True
	for ele in d:
		if d[ele] % n != 0:
			cond = False
			break
	if cond == True:
		print('YES')
	else:
		print('NO')


def ans_f(s):
	char = [0] * 26
	for i in s:
		for j in range(26):
			char[j] += i.count(chr(97 + j))
	for i in char:
		if i % len(s) != 0:
			return 'NO'
	return 'YES'
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	s = []
	for i in range(n):
		s.append(input())
	ans.append(ans_f(s))
for i in ans:
	print(i)


for i in range(int(input())):
	n = int(input())
	s = ''
	for j in range(n):
		k = input()
		s += k
	r = set(s)
	f = 1
	for q in r:
		if s.count(q) % n != 0:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for i in s:
			try:
				d[i] += 1
			except:
				d[i] = 1
	flag = 0
	for keys in d:
		if d[keys] % n != 0:
			flag = 1
	if flag:
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	n = int(input())

	def solver(n):
		s = [0] * 26
		a = ord('a')
		for i in range(n):
			for j in input():
				s[ord(j) - a] += 1
		for i in s:
			if i % n != 0:
				return 'NO'
		return 'YES'
	print(solver(n))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(input())
	dl = []
	for i in l:
		dl.append(dict(Counter(i)))
	final = {}
	final = dl[0]
	for i in range(1, n):
		dd = dl[i]
		for j in dd:
			if j not in final:
				final[j] = 0
			final[j] += dd[j]
	ans = 0
	for key in final:
		if final[key] % n != 0:
			ans = 1
			break
	if ans:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	words = [0] * 26
	cnt = 0
	for i in range(n):
		s = input()
		cnt += len(s)
		for x in s:
			words[ord(x) - 97] += 1
	if cnt % n != 0:
		print('NO')
		continue
	yep = False
	for x in words:
		if x % n != 0:
			print('NO')
			yep = True
			break
	if not yep:
		print('YES')


def ans(a, n):
	d = {}
	for i in a:
		for j in i:
			if j not in d:
				d[j] = 1
			else:
				d[j] += 1
	lis = list(d.values())
	for i in lis:
		if i % n != 0:
			return 'NO'
	return 'YES'
m = int(input())
for i in range(m):
	n = int(input())
	arr = []
	for i in range(n):
		x = input()
		arr.append(x)
	print(ans(arr, n))


from collections import Counter
for i in range(int(input())):
	s = ''
	n = int(input())
	for j in range(n):
		k = input()
		s += k
	l = list(s)
	z = Counter(l)
	o = 0
	valu = [i for i in z.values()]
	for j in range(len(valu)):
		if valu[j] % n != 0:
			print('NO')
			o = 1
			break
	if o != 1:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	str = ''
	st = []
	flag = 0
	for i in range(n):
		s = input()
		str += s
		sx = [x for x in s]
		st.extend(sx)
	se = set(st)
	for i in se:
		c = st.count(i)
		if c % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	elif flag == 1:
		print('NO')


for _ in range(int(input())):
	a = 0
	n = int(input())
	l = ''
	for _ in range(n):
		l += input()
	k = set(l)
	for i in k:
		x = l.count(i)
		if x % n > 0:
			a = 1
			break
	print(['YES', 'NO'][a == 1])


from collections import Counter
n = int(input())
for i in range(n):
	t = int(input())
	c = Counter()
	for j in range(t):
		c += Counter(input())
	tmp = [x % t == 0 for x in c.values()]
	if all(tmp):
		print('YES')
	else:
		print('NO')


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	s = ''
	f = [0] * 26
	for i in range(n):
		tmp = inp()
		s += tmp
	s = list(s)
	for i in s:
		f[ord(i) - 97] += 1
	for i in f:
		if i != 0 and i % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
for i in range(int(input())):
	str = ''
	ans = True
	n = int(input())
	for j in range(n):
		str += input()
	a = Counter(str).most_common()
	for k in a:
		if k[1] % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


import collections as co
t = int(input())
for _ in range(t):
	ans = 'YES'
	a = ''
	n = int(input())
	for j in range(n):
		a += input()
	if len(a) % n != 0:
		ans = 'NO'
	else:
		cnt = co.Counter(a)
		for c in cnt.values():
			if c % n != 0:
				ans = 'NO'
				break
	print(ans)


a = int(input())
for x in range(a):
	d = []
	b = int(input())
	for y in range(b):
		c = input()
		d.append(c)
	e = [0 for y in range(26)]
	for i in d:
		for j in i:
			e[ord(j) - 97] += 1
	n = 0
	for y in range(26):
		if e[y] % b != 0:
			break
		else:
			n += 1
	if n == 26:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	n1 = n
	new = ''
	a = []
	flag = 0
	while n:
		s = input()
		new = new + s
		n -= 1
	s1 = set(new)
	for i in s1:
		a.append(new.count(i))
	for i in a:
		if i % n1 == 0:
			pass
		else:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


for x in range(int(input())):
	strings = []
	s = set()
	n = int(input())
	for i in range(n):
		st = input()
		strings.append(st)
		s = s | set(st)
	for sym in s:
		su = 0
		for st in strings:
			su += st.count(sym)
		if su % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
alphabet = [chr(x) for x in range(ord('a'), ord('z') + 1)]
i = 0
c = 0
for i in range(t):
	n = int(input())
	sum = {}
	item = 0
	j = 0
	for item in alphabet:
		sum[item] = 0
	for j in range(n):
		s = input()
		l = list(s)
		items = 0
		for items in alphabet:
			sum[items] = sum[items] + l.count(items)
	for ele in alphabet:
		if sum[ele] % n == 0:
			c = 1
		else:
			print('NO')
			c = 0
			break
	if c == 1:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	z = 0
	b = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
	for i in range(n):
		a = input()
		z += len(a)
		for j in range(97, 123):
			b[j - 97] += a.count(chr(j))
	if z % n != 0:
		print('NO')
	else:
		x = 1
		for l in range(len(b)):
			if b[l] % n != 0:
				x = 0
				break
		if x == 1:
			print('YES')
		else:
			print('NO')


def ans(strings):
	d = dict()
	for s in strings:
		for x in s:
			d[x] = d.get(x, 0) + 1
	for k in d.keys():
		if d[k] % len(strings) != 0:
			return 'NO'
	return 'YES'
t = int(input())
L = []
for i in range(t):
	n = int(input())
	strings = []
	for j in range(n):
		strings.append(input())
	L.append(ans(strings))
for l in L:
	print(l)


x = int(input())
for i in range(0, x):
	n = int(input())
	ar = []
	b = []
	for j in range(0, n):
		s = input()
		d = list(s)
		ar = ar + d
	r = 0
	b = ar
	set(b)
	for k in range(0, len(b)):
		g = ar.count(b[k])
		if g % n != 0:
			r = r + 1
			break
	if r:
		print('NO')
	else:
		print('YES')


for test in range(int(input())):
	n = int(input())
	arr = []
	for test2 in range(n):
		arr.append(input().strip())
	d = {}
	for i in range(n):
		for j in range(len(arr[i])):
			if d.get(arr[i][j]) != None:
				d[arr[i][j]] += 1
			else:
				d[arr[i][j]] = 1
	f = True
	for v in d.values():
		if v % n != 0:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


from time import sleep as sle
from math import *
from random import randint as ri

def solve():
	t = int(input())
	for _ in range(t):
		n = int(input())
		cL = []
		for i in range(n):
			cL += [c for c in input()]
			cL.sort()
		sec = set(cL)
		mL = [cL.count(c) % n for c in sec]
		bL = [q == 0 for q in mL]
		if False in bL:
			print('NO')
		else:
			print('YES')
solve()


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	S = []
	C = Counter()
	for i in range(N):
		s = input()
		C += Counter(s)
		S.append(s)
	for v in C.values():
		if v % N != 0:
			NO()
			break
	else:
		YES()


import sys, random
input = sys.stdin.readline

def check():
	n = int(input())
	str = []
	for i in range(n):
		s = input()
		str.append(s.strip())
	al = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	freq = {i: 0 for i in al}
	for s in str:
		for i in range(len(s)):
			freq[s[i]] += 1
	for i in freq:
		if freq[i] % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	print(check())


numTests = int(input())
for testNo in range(numTests):
	n = int(input())
	cnt = [0 for i in range(26)]
	for _ in range(n):
		s = input()
		for i in s:
			cnt[ord(i) - 97] += 1
	ans = True
	for i in range(26):
		if cnt[i] % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			if j not in d:
				d[j] = 1
			else:
				d[j] += 1
	f = 0
	for i in d:
		if d[i] % n != 0:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')
	t = t - 1


import sys
import math
from math import *
from collections import Counter, defaultdict

def main():
	n = int(input())
	arr = []
	d = defaultdict(lambda : 0)
	for i in range(n):
		arr.append(input())
	for i in arr:
		for j in i:
			d[j] += 1
	for (i, j) in d.items():
		if j % n:
			print('NO')
			return
	print('YES')
for i in range(int(input())):
	main()


from collections import Counter

def main():
	for _ in range(int(input())):
		flag = 0
		n = int(input())
		a = ''
		for z in range(n):
			a += input()
		b = Counter(a)
		for i in b.values():
			if i % n != 0:
				flag = 1
				print('NO')
				break
		if not flag:
			print('YES')
main()


t = int(input())
while t > 0:
	n = int(input())
	l = [0] * 26
	for i in range(n):
		x = input()
		for j in x:
			l[ord(j) - ord('a')] += 1
	f = 0
	for i in l:
		if i % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
while t > 0:
	t = t - 1
	l = []
	n = int(input())
	lenl = n
	all_freq = {}
	while n > 0:
		n = n - 1
		temp = input()
		l.append(temp)
		for i in temp:
			if i in all_freq:
				all_freq[i] += 1
			else:
				all_freq[i] = 1
	temp1 = list(all_freq.values())
	check = True
	for i in temp1:
		if i % lenl != 0:
			check = False
	if check:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	d = defaultdict(int)
	for __ in range(n):
		s = input()
		for x in s:
			d[x] += 1
	flag = 0
	for x in d:
		if d[x] % n != 0:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	dicti = {}
	for j in range(n):
		s = input()
		for k in s:
			if k in dicti.keys():
				dicti[k] += 1
			else:
				dicti[k] = 1
	for j in dicti.keys():
		if dicti[j] % n != 0:
			print('NO')
			break
	else:
		print('YES')


typeofresult = True

def solve(q):
	ans = 'YES'
	(n, s) = q
	p = []
	o = ''
	for j in range(len(s)):
		o += s[j]
		for k in range(len(s[j])):
			p.append(s[j][k:k + 1])
	p = set(p)
	p = list(p)
	for e in range(len(p)):
		if o.count(p[e]) % n != 0:
			ans = 'NO'
	return ans

def testcases(b):
	if b == True:
		t = int(input())
		for tc in range(1, t + 1):
			n = int(input())
			s = []
			for i in range(n):
				s.append(str(input()))
			ans = solve([n, s])
			print(ans)
	else:
		ans = solve(l)
		print('Case #%d: %d' % (tc, ans))
testcases(typeofresult)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = ''
	for x in range(n):
		a += input().rstrip()
	flag = 'YES'
	for x in a:
		if a.count(x) % n:
			flag = 'NO'
			break
	print(flag)


for t in range(int(input())):
	x = {c: 0 for c in 'abcdefghijklmnopqrstuvwxyz'}
	s = ''
	n = int(input())
	for i in range(n):
		s += input()
	for c in s:
		x[c] += 1
	for i in x.values():
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
cases = int(input())
for t in range(cases):
	n = int(input())
	d = {}
	for i in range(n):
		s = Counter(input())
		for j in s:
			if j in d:
				d[j] += s[j]
			else:
				d[j] = s[j]
	f = 0
	for i in d:
		if d[i] % n != 0:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	table = [0] * 26
	for _ in range(n):
		for x in input()[:-1]:
			table[ord(x) - ord('a')] += 1
	for i in range(26):
		if table[i] % n:
			print('NO')
			break
	else:
		print('YES')


for t in range(int(input())):
	n = int(input())
	a = [0] * 26
	for i in range(n):
		s = input()
		for j in s:
			a[ord(j) - 97] += 1
	for i in a:
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	alphabet = dict()
	flag = False
	for _ in range(n):
		for char in input():
			alphabet[char] = alphabet.get(char, 0) + 1
	for (key, val) in alphabet.items():
		if val % n != 0:
			flag = True
			break
	if not flag:
		print('YES')
	else:
		print('NO')


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	f = 0
	for i in range(n):
		s = input()
		l.append(s)
	a = ''.join(l)
	b = Counter(a)
	d = dict(b)
	x = [j for j in d.values()]
	for k in x:
		if k % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def solve():
	n = int(inp())
	s = ''
	for _ in range(n):
		s += inp()
	k = counter(s)
	t = 1
	for i in k.values():
		if i % n != 0:
			t = -1
			break
	if t == 1:
		print('YES')
	else:
		print('NO')
testcase(int(inp()))


def tke():
	return list(map(int, input().split()))
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'h', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
n = int(input())
for x in range(n):
	a = int(input())
	A = []
	for y in range(a):
		A.append(input())
	for ii in letters:
		if ''.join(A).count(ii) / a == ''.join(A).count(ii) // a:
			pass
		else:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
t = int(input())
for o in range(t):
	n = int(input())
	a = []
	p = 'YES'
	for i in range(n):
		a.append(input())
	a = ''.join(a)
	b = Counter(a)
	c = list(b.values())
	for i in c:
		if i % n != 0:
			p = 'NO'
	print(p)


t = int(input())
for i in range(t):
	n = int(input())
	count = {}
	for j in range(n):
		s = input()
		for c in s:
			if c in count:
				count[c] += 1
			else:
				count[c] = 1
	answer = 'YES'
	for k in count:
		if count[k] % n != 0:
			answer = 'NO'
			break
	print(answer)


t = int(input())
while t:
	n = int(input())
	string = []
	for i in range(n):
		temp_string = input()
		string.append(temp_string)
	count = []
	temp = ''
	for val in string:
		temp += val
	set_count = list(set(temp))
	for char in set_count:
		counter = 0
		for val in string:
			counter += val.count(char)
		count.append(counter)
	flag = 1
	for val in count:
		if val % n != 0:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


import collections
t = int(input())
for i in range(t):
	n = int(input())
	a = ''
	for i in range(n):
		s = input()
		a = a + s
	if len(a) % 2 == 0 and n % 2 == 0:
		l = list(a)
		c = -1
		fr = collections.Counter(l)
		for (key, val) in fr.items():
			if val % 2 != 0:
				c += 1
		if c == -1:
			print('YES')
		else:
			print('NO')
	else:
		l = list(a)
		c = -1
		fr = collections.Counter(l)
		for (key, val) in fr.items():
			if val % n != 0:
				c += 1
		if c == -1:
			print('YES')
		else:
			print('NO')


from collections import Counter

def solve():
	n = int(input())
	s = [input() for _ in range(n)]
	counter = Counter(''.join(s))
	for k in counter:
		if counter[k] % n != 0:
			return 'NO'
	return 'YES'
T = int(input())
for case in range(T):
	print(solve())


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	x = ''
	for i in range(n):
		x += input()
	d_s = dict(Counter(x))
	isPossible = True
	for (k, v) in d_s.items():
		if v % n != 0:
			isPossible = False
	if isPossible:
		print('YES')
	else:
		print('NO')


def call():
	n = int(input())
	s = Counter()
	for i in range(n):
		s.update(input())
	for i in s.values():
		if i % n != 0:
			return 'NO'
	return 'YES'
from collections import Counter
for i in range(int(input())):
	print(call())


t = int(input())
for l in range(t):
	n = int(input())
	lst = []
	for i in range(n):
		arr = input()
		for j in range(len(arr)):
			lst.append(arr[j])
	lst.sort()
	m = 0
	count = 1
	flag = 0
	if len(lst) % n != 0:
		print('NO')
	else:
		for m in range(len(lst) - 1):
			if lst[m] == lst[m + 1]:
				count += 1
			elif lst[m] != lst[m + 1]:
				if count % n != 0:
					flag = 1
					break
				else:
					count -= count - 1
		if flag != 0:
			print('NO')
		else:
			print('YES')


t = int(input())
while t > 0:
	dic = {}
	n = int(input())
	k = n
	while n > 0:
		s = input()
		for i in s:
			if i not in dic:
				dic[i] = 1
			else:
				dic[i] += 1
		n -= 1
	flag = 0
	for key in dic.keys():
		if dic[key] % k != 0:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')
	t -= 1


def check(d, n):
	for (key, value) in d.items():
		if value % n != 0:
			return 'NO'
	return 'YES'
from collections import defaultdict
cases = int(input())
for _ in range(cases):
	d = defaultdict(int)
	n = int(input())
	for i in range(n):
		m = input()
		for x in m:
			d[x] += 1
	print(check(d, n))


from sys import stdin
for _ in range(int(input())):
	n = int(input())
	stringDict = {}
	for i in range(n):
		s = stdin.readline().rstrip()
		for c in s:
			if c in stringDict:
				stringDict[c] += 1
			else:
				stringDict[c] = 1
	ans = 'YES'
	for c in stringDict:
		if stringDict[c] % n != 0:
			ans = 'NO'
			break
	print(ans)


d = ord('a')
let = 26
r = ''
t = int(input())
for i in range(t):
	a = [0] * let
	n = int(input())
	for j in range(n):
		s = input()
		for k in range(len(s)):
			a[ord(s[k]) - d] += 1
	s = 'YES'
	for j in range(let):
		if a[j] % n != 0:
			s = 'NO'
			break
	r += s + '\n'
print(r)


n = int(input())
for i in range(n):
	mas = []
	flag = True
	full = ''
	k = int(input())
	for j in range(k):
		st = input()
		full += st
	full = list(full)
	a = set(full)
	full.sort()
	for e in a:
		if full.count(e) % k != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


n = int(input())
for i in range(0, n):
	n1 = int(input())
	d = {}
	for j in range(0, n1):
		s = input()
		for k in s:
			if k in d:
				d[k] += 1
			else:
				d[k] = 1
	f = 0
	for j in d:
		if d[j] % n1 != 0:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


from string import ascii_lowercase as az

def check(d, n) -> str:
	for l in az:
		d[l] = d[l] % n
	res = all((x == 0 for x in d.values()))
	if res == 0:
		return 'NO'
	else:
		return 'YES'

def inset() -> dict:
	d = {}
	for i in az:
		d[i] = int(0)
	return d
t = int(input())
for i in range(t):
	d = {}
	d = inset()
	n = int(input())
	for j in range(n):
		s = str(input())
		for k in az:
			d[k] = d[k] + s.count(k)
	print(check(d, n))


for _ in range(int(input())):
	n = int(input())
	s = []
	for i in range(n):
		s.append(input())
	sum = [0 for i in range(26)]
	for i in range(n):
		for ch in s[i]:
			sum[ord(ch) - 97] += 1
	ans = True
	for i in range(26):
		if sum[i] % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	T = iin()
	for t in range(T):
		n = iin()
		s = [input() for i in range(n)]
		dc = [0] * 26
		zo = ord('a')
		for i in s:
			for j in i:
				dc[(ord(j) - zo) % 26] += 1
		for i in dc:
			if i % n == 0:
				pass
			else:
				print('NO')
				break
		else:
			print('YES')
main()


for _ in range(int(input())):
	n = int(input())
	l = [0] * 26
	s1 = ''
	for i in range(n):
		s = input()
		s1 = s1 + s
	for i in s1:
		l[ord(i) - 97] += 1
	flag = 1
	for i in l:
		if i % n != 0:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = []
	ans = True
	for j in range(n):
		s = s + list(input())
	s.sort()
	while s != []:
		c = s.count(s[0])
		s = s[c:]
		if c % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	w = ''
	for i in range(n):
		w = w + input()
	c = 0
	for i in w:
		if w.count(i) % n == 0:
			c += 1
	if c == len(w):
		print('YES')
	else:
		print('NO')


n = int(input())
b = []
c = []
d = []
for i in range(n):
	m = int(input())
	for j in range(m):
		a = input()
		a.split()
		a = list(a)
		b.extend(a)
	c.extend(b)
	b = set(b)
	b = list(b)
	for k in range(len(b)):
		c1 = 0
		for v in range(len(c)):
			if b[k] == c[v]:
				c1 += 1
		d.append(c1)
	c2 = 0
	for x in range(len(d)):
		if d[x] % m == 0:
			c2 += 1
	s = sum(d)
	if c2 == len(d) and s % m == 0:
		print('YES')
	else:
		print('NO')
	b.clear()
	c.clear()
	d.clear()


from math import *
from copy import *
from string import *
from random import *
from sys import stdin, stdout
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math
import math
import time
from queue import Queue

def seive(n):
	l = [True]
	l = l * (n + 1)
	for i in range(2, int(sqrt(n)) + 1):
		if l[i] == True:
			val = i * i
			while val < len(l):
				l[val] = False
				val += i
	prime = []
	for i in range(2, len(l)):
		if l[i] == True:
			prime.append(i)
	return prime

def dp(l, i, n, val, ans):
	if i >= n or val < 0:
		return 1000000
	elif val == 0:
		return 0
	else:
		if ans[i] == 1000000:
			ans[i] = min(min(1 + dp(l, i + 1, n, val - l[i], ans), 1 + dp(l, i, n, val - l[i], ans)), dp(l, i + 1, n, val, ans))
		return ans[i]
from queue import Queue

def factors(n):
	l = []
	for i in range(1, int(sqrt(n)) + 1):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def check1(s, v, x):
	while True:
		if v not in s:
			return v
		else:
			v -= 1

def check2(s, v, x):
	while True:
		if v not in s:
			return v
		else:
			v += 1

def up(n):
	j = n - 1
	while j > 0:
		if n % j == 0:
			break
		j -= 1
	return j

def fac(n):
	c = 1
	i = 1
	while i <= n:
		c *= i
		i += 1
	return c

def check_happy(n):
	ss = set()
	print(n)
	while n != 1:
		val = n
		s = 0
		print(val)
		while val != 0:
			s += (val % 10) ** 2
			val = val // 10
		print(val)
		print('hi')
		if val in ss:
			return False
		else:
			n = val
			ss.add(n)
	return True

def update(a, b):
	c = 1
	val = a
	while a < b:
		print(c, a)
		c += c
		a += a
	print(1)
	while a > b:
		print()
		a -= val
		c -= 1
	return c
import random as rand

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
from itertools import permutations

def insertion_sort(arr):
	for i in range(len(arr)):
		j = i
		while j > 0:
			if arr[j] < arr[j - 1]:
				temp = arr[j]
				arr[j] = arr[j - 1]
				arr[j - 1] = temp
			j -= 1
	return arr

def quick_sort(arr, low, high):
	i = low
	j = high
	while i < j:
		if arr[i] > arr[low] and arr[j] < arr[low]:
			temp = arr[i]
			arr[i] = arr[j]
			arr[j] = arr[i]
			i += 1
			j -= 1
		elif arr[i] <= arr[low]:
			i += 1
		elif arr[j] >= arr[low]:
			j -= 1
	print(i, j)
	toto = arr[j]
	arr[j] = arr[low]
	arr[low] = toto
	return j

def dodo(arr, low, high):
	if low < high:
		val = quick_sort(arr, low, high)
		dodo(arr, low, val - 1)
		dodo(arr, val + 1, high)

def dp(arr, c, n, k, z, ans):
	if k == 0:
		return ans
	elif c == 0:
		return dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1])
	elif c == n - 1:
		if z == 0:
			return 0
		else:
			return dp(arr, c - 1, n, k - 1, z - 1, ans + arr[c - 1])
	elif z == 0:
		return dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1])
	else:
		return max(dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1]), dp(arr, c - 1, n, k - 1, z - 1, ans + arr[c - 1]))

def check(arr, val):
	a = -1
	for i in range(len(arr)):
		if arr[i][len(arr[i]) - 1] == val:
			a = i
			break
	return a

def reverse(s, i, ans):
	if i >= len(s):
		return ans
	else:
		return reverse(s, i + 1, s[i] + ans)

def update(arr, i, j, n, m):
	if i >= 0 and i < n and (j >= 0) and (j < m):
		if arr[i][j] == 1:
			arr[i][j] == 2
			return [i, j]
	return [-1, -1]
t = int(input())
for i in range(t):
	n = int(input())
	arr = [0] * 60
	for j in range(n):
		s = str(input())
		for k in s:
			arr[ord(k) - 65] += 1
	boo = True
	for j in arr:
		if j % n != 0:
			boo = False
			break
	if boo:
		print('YES')
	else:
		print('NO')


for T in range(int(input())):
	n = int(input())
	a = [0 for i in range(26)]
	for i in range(n):
		s = input()
		for j in range(len(s)):
			a[ord(s[j]) - 97] += 1
	no = False
	for i in range(26):
		if a[i] % n != 0:
			no = True
			break
	if no:
		print('NO')
	else:
		print('YES')


from sys import stdin
input = stdin.readline

def A():
	t = int(input())
	for _ in range(t):
		d = [0] * 26
		n = int(input())
		for j in range(n):
			for i in input().rstrip():
				d[ord(i) - ord('a')] += 1
		truth = True
		for i in range(26):
			if d[i] % n != 0:
				truth = False
				break
		if truth:
			print('YES')
		else:
			print('NO')
A()


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = ''
	for i in range(n):
		a += input()
	c = Counter(a)
	flag = 0
	for i in set(a):
		if c[i] % n != 0:
			flag = 1
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	count = {}
	n = int(input())
	for j in range(n):
		s = input()
		for k in s:
			count[k] = count.get(k, 0) + 1
	flag = 0
	for j in count:
		if count[j] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


def main():
	tests = int(input())
	for i in range(tests):
		n_str = int(input())
		chars = ''
		for j in range(n_str):
			chars += input()
		chars = ''.join(sorted(chars))
		if len(chars) % n_str != 0:
			print('NO')
			continue
		j = 0
		bad = False
		while j < len(chars):
			if chars[j:j + n_str] != chars[j] * n_str:
				bad = True
				print('NO')
				break
			j += n_str
		if not bad:
			print('YES')
main()


def main():
	n = int(input())
	d = {}
	for _ in range(n):
		s = input()
		for char in s:
			if d.get(char) == None:
				d[char] = 1
			else:
				d[char] += 1
	for (key, value) in d.items():
		if value % n != 0:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	main()


import sys
import math
import collections
from sys import stdin, stdout, setrecursionlimit
import bisect as bs
setrecursionlimit(2 ** 20)
M = 10 ** 9 + 7
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	d = {}
	for i in range(n):
		s = stdin.readline().strip('\n')
		for c in s:
			if c not in d:
				d[c] = 0
			d[c] += 1
	res = True
	for c in d:
		if d[c] % n != 0:
			res = False
			break
	if res:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	num = [0 for i in range(26)]
	n = int(input())
	for _ in range(n):
		s = input()
		for i in s:
			x = ord(i) - 97
			num[x] += 1
	f1 = 0
	for i in num:
		if i % n != 0:
			f1 = 1
			break
	if f1 == 0:
		print('YES')
	else:
		print('NO')


def solve():
	a = dict()
	n = int(input())
	for tt in range(n):
		for x in input():
			try:
				a[x] += 1
			except:
				a[x] = 1
	for x in a:
		if a[x] % n != 0:
			return 'NO'
	return 'YES'
for t in range(int(input())):
	print(solve())


for r in range(int(input())):
	n = int(input())
	s = []
	d = {}
	c = 0
	for i in range(n):
		s.append(str(input()))
	for i in range(n):
		for j in range(len(s[i])):
			if s[i][j] not in d:
				d[s[i][j]] = 1
			else:
				d[s[i][j]] += 1
	d1 = list(d.keys())
	for i in range(len(d1)):
		if d[d1[i]] % n != 0:
			c = 1
			break
	if c == 1:
		print('NO')
	else:
		print('YES')


def find(j, l):
	for i in range(len(l)):
		if j == l[i][0]:
			return i
	return -1

def init(j, l):
	l.append([j, 1])

def fill(j, l):
	l[find(j, l)][1] += 1

def test(l):
	var = True
	for liss in l:
		if liss[1] % n != 0:
			var = False
			break
	return var
number = int(input())
for counter in range(number):
	n = int(input())
	l = []
	for i in range(n):
		ch = input()
		for j in ch:
			if find(j, l) != -1:
				fill(j, l)
			else:
				init(j, l)
	if test(l):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	dic = {}
	flag = 0
	for i in range(n):
		a = input()
		s += a
	for ch in s:
		if ch not in dic:
			dic[ch] = 1
		else:
			dic[ch] += 1
	for (k, v) in dic.items():
		if v % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = ''
	f = True
	for i in range(n):
		s += input()
	for p in list(set(s)):
		if s.count(p) % n != 0:
			print('NO')
			f = False
			break
	if f:
		print('YES')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solveTest():
	word = []
	charCounter = {}
	testWordCount = inp()
	solvable = True
	for test in range(testWordCount):
		word += insr()
	for char in word:
		if char in charCounter:
			charCounter[char] += 1
		else:
			charCounter[char] = 1
	for (char, amount) in charCounter.items():
		if amount % testWordCount != 0:
			solvable = False
	result.append('YES') if solvable else result.append('NO')
result = []
for i in range(inp()):
	solveTest()
for subResult in result:
	print(subResult)


from collections import defaultdict
tc = int(input())
for _ in range(tc):
	n = int(input())
	combinedString = ''
	for _ in range(n):
		combinedString += input().strip()
	dic = defaultdict(int)
	for char in combinedString:
		dic[char] += 1
	flag = 0
	for char in dic.keys():
		if dic[char] % n != 0:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	word = ''.join([input() for _ in range(n)])
	c = [word.count(chr(i + 97)) for i in range(26)]
	if all((not i % n for i in c)):
		print('YES')
	else:
		print('NO')


import sys

def i():
	return sys.stdin.readline()[:-1]

def insert(d, key):
	if key in d.keys():
		d[key] += 1
	else:
		d[key] = 1
cases = int(i())
for a in range(cases):
	numStrings = int(i())
	listStr = list((i() for y in range(numStrings)))
	charCount = {}
	for s in listStr:
		for char in s:
			insert(charCount, char)
	equal = True
	for key in charCount.keys():
		if charCount[key] % numStrings != 0:
			equal = False
	print('YES' if equal else 'NO')


def juggle(n, a):
	dic = {}
	string = ''
	for s in a:
		string += s
	for x in string:
		if x in dic:
			dic[x] += 1
		else:
			dic[x] = 1
	for i in dic:
		if dic[i] % n == 0:
			continue
		else:
			return 'NO'
	return 'YES'
t = int(input())
a = []
for i in range(t):
	n = int(input())
	array = []
	for j in range(n):
		array.append(input())
	a.append([n, array])
for x in a:
	print(juggle(*x))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		s = input()
		for e in s:
			l.append(e)
	cnt = Counter(l)
	f = True
	for e in cnt.values():
		if e % n != 0:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	check = [0] * 26
	flag = 0
	for i in range(n):
		s = input()
		for i in s:
			check[ord(i) - 97] += 1
	for i in range(26):
		if check[i] % n != 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	u = []
	for i in range(n):
		u += list(input())
	abc = [0] * 26
	for i in range(len(u)):
		abc[ord(u[i]) - ord('a')] += 1
	for i in range(26):
		if abc[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	l = [0] * 26
	for i in s:
		l[ord(i) - 97] += 1
	f = 0
	for i in l:
		if i % n == 0:
			pass
		else:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


def ch():
	tmp_dict = {}
	for i in range(97, 97 + 26):
		tmp_dict.update({chr(i): 0})
	n = int(input())
	for i in range(n):
		st = input()
		for j in st:
			tmp_dict[j] += 1
	for k in tmp_dict.values():
		if k % n:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	print(ch())


import sys
input = sys.stdin.readline
T = int(input())
while T:
	n = int(input())
	D = {}
	for i in range(n):
		s = list(input())
		for i in s:
			if i not in D:
				D[i] = 1
			else:
				D[i] += 1
	F = 'YES'
	for i in D:
		if D[i] % n != 0:
			F = 'NO'
			break
	print(F)
	T = T - 1


for i in range(int(input())):
	n = int(input())
	mat = [0 for i in range(26)]
	for j in range(n):
		s = input()
		for l in s:
			tinx = ord(l) - 97
			mat[tinx] += 1
	flag = 1
	for i in range(26):
		if mat[i] % n != 0:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


def canBeDividedInEqualStrings(completeString, numOfEqualParts):
	if len(completeString) % numOfEqualParts != 0:
		return False
	for letter in completeString:
		if completeString.count(letter) % numOfEqualParts != 0:
			return False
	return True
numOFtestCases = int(input())
for i in range(numOFtestCases):
	completeString = ''
	numOfStrings = int(input())
	for _ in range(numOfStrings):
		completeString += input()
	if canBeDividedInEqualStrings(completeString, numOfStrings):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	stk = ''
	n = int(input())
	for _ in range(n):
		x = input()
		stk += x
	isEqual = True
	for k in set(stk):
		if stk.count(k) % n != 0:
			isEqual = False
			break
	if isEqual:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(input())
	a = [0] * 27
	for i in l:
		for j in range(len(i)):
			number = ord(i[j]) - 96
			a[number] += 1
	count = 0
	ma = max(a)
	flag = 0
	for i in range(1, len(a)):
		if a[i] > 0:
			if a[i] % n == 0:
				flag = 1
			else:
				flag = 0
				break
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	N = int(input())
	Count = [0] * 26
	for i in range(N):
		temp = input()
		for x in temp:
			Count[ord(x) - ord('a')] += 1
	flag = 0
	for i in range(26):
		if Count[i] % N != 0:
			print('NO')
			flag = 1
			break
	if not flag:
		print('YES')


from collections import Counter
import sys
input = sys.stdin.readline

def print(val):
	sys.stdout.write(str(val) + '\n')

def prog():
	for _ in range(int(input())):
		n = int(input())
		a = Counter()
		for i in range(n):
			a.update(input().strip())
		fail = False
		for b in a.values():
			if b % n != 0:
				print('NO')
				fail = True
				break
		if not fail:
			print('YES')
prog()


def Test():
	t = int(input())
	while t > 0:
		t -= 1
		soln()

def soln():
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	for i in d.keys():
		if d[i] % n != 0:
			print('NO')
			return
	print('YES')
	return
Test()


import math
ls = lambda : list(map(int, input().split()))
ip = lambda : int(input())
sip = lambda : input()
r = lambda a: range(a)
lcm = lambda a, b: abs(a * b) // math.gcd(a, b)
t = ip()
for _ in r(t):
	n = ip()
	strings = {}
	for i in range(n):
		s = sip()
		for i in s:
			if i not in strings:
				strings[i] = 1
			else:
				strings[i] += 1
	no = False
	for i in strings.values():
		if i < n:
			no = True
			print('NO')
			break
		if i > n and i % n != 0:
			no = True
			print('NO')
			break
	if not no:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	s = ''
	for j in range(n):
		s1 = input()
		s += s1
	s = list(s)
	s.sort()
	contador = 1
	flag = 1
	for j in range(len(s) - 1):
		if s[j] == s[j + 1]:
			contador += 1
		elif contador % n != 0:
			flag = 0
			break
		else:
			contador = 1
	if contador % n != 0:
		flag = 0
	print('YES' if flag == 1 else 'NO')


for _ in range(int(input())):
	a = ''
	err = 0
	n = int(input())
	for _ in range(n):
		a += input()
	a = sorted(list(a))
	b = set(a)
	for i in b:
		if a.count(i) % n != 0:
			err = 1
	if err == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	arr = [0] * 26
	for j in range(n):
		x = input()
		for k in x:
			arr[ord(k) - ord('a')] += 1
	for j in arr:
		if j % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	dic = {}
	for i in range(n):
		s = input()
		for x in s:
			if x in dic:
				dic[x] += 1
			else:
				dic[x] = 1
	poss = True
	for key in dic:
		if dic[key] % n != 0:
			poss = False
			break
	if poss:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
from collections import defaultdict as dc
for _ in range(N()):
	dic = dc(int)
	n = N()
	for _ in range(n):
		s = input()
		for c in s:
			dic[c] += 1
	flag = True
	for k in dic:
		if dic[k] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	N = int(input())
	d = dict()
	for n in range(N):
		s = input()
		for i in s:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	f = True
	for i in d:
		if d[i] % N != 0:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	num = int(input())
	d = {}
	for i in range(num):
		s = input()
		for i in s:
			d[i] = d.get(i, 0) + 1
	val = list(d.values())
	flag = 1
	for i in val:
		if i % num != 0:
			print('NO')
			flag = 0
			break
	if flag:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	cnt = {}
	for i in range(n):
		cur = input()
		for j in cur:
			cnt[j] = cnt.get(j, 0) + 1
	valid = True
	for i in cnt.values():
		if i % n != 0:
			valid = False
	if valid:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	x = []
	n = int(input())
	for i in range(n):
		s = str(input())
		for i in s:
			x.append(i)
	ans = True
	for i in x:
		if x.count(i) % n != 0:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


import sys
from collections import defaultdict
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	d = defaultdict(int)
	for i in range(n):
		s = input().strip()
		for j in s:
			d[j] += 1
	for i in d.values():
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	n = int(input())
	d = {}
	for i in range(n):
		s = input().rstrip()
		for x in s:
			if d.get(x) != None:
				d[x] += 1
			else:
				d[x] = 1
	for x in d.values():
		if x % n != 0:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	solve()


t = int(input())
ansLst = []
for tt in range(t):
	n = int(input())
	strLst = []
	alph = []
	for x in range(27):
		alph.append(0)
	for nn in range(n):
		strLst.append(input())
	for i in strLst:
		for j in i:
			if j == 'a':
				alph[1] += 1
			elif j == 'b':
				alph[2] += 1
			elif j == 'c':
				alph[3] += 1
			elif j == 'd':
				alph[4] += 1
			elif j == 'e':
				alph[5] += 1
			elif j == 'f':
				alph[6] += 1
			elif j == 'g':
				alph[7] += 1
			elif j == 'h':
				alph[8] += 1
			elif j == 'i':
				alph[9] += 1
			elif j == 'j':
				alph[10] += 1
			elif j == 'k':
				alph[11] += 1
			elif j == 'l':
				alph[12] += 1
			elif j == 'm':
				alph[13] += 1
			elif j == 'n':
				alph[14] += 1
			elif j == 'o':
				alph[15] += 1
			elif j == 'p':
				alph[16] += 1
			elif j == 'q':
				alph[17] += 1
			elif j == 'r':
				alph[18] += 1
			elif j == 's':
				alph[19] += 1
			elif j == 't':
				alph[20] += 1
			elif j == 'u':
				alph[21] += 1
			elif j == 'v':
				alph[22] += 1
			elif j == 'w':
				alph[23] += 1
			elif j == 'x':
				alph[24] += 1
			elif j == 'y':
				alph[25] += 1
			else:
				alph[26] += 1
	for x in range(1, len(alph)):
		if alph[x] % n != 0:
			ansLst.append('NO')
			break
		if x == 26:
			if alph[x] % n == 0:
				ansLst.append('YES')
				break
for i in ansLst:
	print(i)


t = int(input())
while t != 0:
	result = 'YES'
	n = int(input())
	ArrS = [[] for i in range(n)]
	for i in range(n):
		ArrS[i] = list(input())
	dictChar = dict()
	for i in range(n):
		for j in range(len(ArrS[i])):
			if ArrS[i][j] not in dictChar:
				dictChar[ArrS[i][j]] = 1
			else:
				dictChar[ArrS[i][j]] += 1
	for key in dictChar:
		if dictChar[key] % n != 0:
			result = 'NO'
			break
	print(result)
	t -= 1


t = int(input())
for i in range(t):
	l = []
	s = ''
	count = 0
	p = 0
	n = int(input())
	for i in range(n):
		l.append(input())
	for i in l:
		s = s + i
	s2 = set(s)
	for i in s2:
		count = s.count(i)
		if count % n != 0:
			print('NO')
			p = 1
			break
	if p == 0:
		print('YES')


t = int(input())
lsi = []
for _ in range(t):
	l = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
	n = int(input())
	for i in range(n):
		s = input()
		for i in s:
			val = l.get(i) + 1
			l.update({i: val})
	ans = l.values()
	flag = 0
	for i in ans:
		if i % n == 0:
			flag = 1
		else:
			lsi.append('NO')
			flag = 0
			break
	if flag == 1:
		lsi.append('YES')
for i in lsi:
	print(i)


for _ in range(int(input())):
	n = int(input())
	l = [list(str(input())) for i in range(n)]
	flag = True
	d = {}
	for i in range(n):
		for j in l[i]:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	for i in d.values():
		if i % n == 0:
			continue
		else:
			flag = False
			print('NO')
			break
	if flag:
		print('YES')


def count_letter_in_string(list_str):
	result = {}
	for s in list_str:
		for i in s:
			if i in result.keys():
				result[i] += 1
			else:
				result[i] = 1
	return result

def solve_problem(num_strs, test_strs):
	len_all_str = 0
	for i in test_strs:
		len_all_str += len(i)
	if 1 <= len_all_str <= 1000:
		for (key, value) in count_letter_in_string(test_strs).items():
			if value % num_strs != 0:
				return 'NO'
		return 'YES'
	else:
		return 'NO'
n = int(input().strip())
for i in range(n):
	num_strs = int(input().strip())
	test_strs = []
	for i in range(num_strs):
		s = input().strip()
		test_strs.append(s)
	result = solve_problem(num_strs, test_strs)
	print(result)


from collections import Counter
for _ in range(int(input())):
	ns = int(input())
	alls = Counter(''.join([input() for _ in range(ns)]))
	canbe = True
	for k in alls:
		if alls[k] % ns:
			canbe = False
			break
	print('YES' if canbe else 'NO')


from collections import Counter
t = int(input())
for T in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	c = Counter(s)
	for x in c.values():
		if x % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	al = dict()
	for i in range(n):
		s = input()
		for e in s:
			if e in al:
				al[e] += 1
			else:
				al[e] = 1
	ans = True
	for e in al:
		if al[e] % n != 0:
			ans = False
			break
	del al
	if ans:
		print('YES')
	else:
		print('NO')


def juggling_letters():
	test_case = int(input())
	for _ in range(test_case):
		cnt = [0 for _ in range(26)]
		n = int(input())
		for _ in range(n):
			_str = input()
			for ch in _str:
				cnt[ord(ch) - ord('a')] += 1
		for value in cnt:
			if value % n:
				print('NO')
				break
		else:
			print('YES')
juggling_letters()


from collections import Counter
t = int(input())
while t:
	n = int(input())
	c = Counter(''.join([input() for i in range(n)]))
	print('YES' if n == 1 or all((c[i] % n == 0 for i in c)) else 'NO')
	t -= 1


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(n)
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)
for xyz in range(0, int(input())):
	n = int(input())
	f = [0] * 26
	for i in range(0, n):
		s = input()
		for c in s:
			f[ord(c) - 97] += 1
	fl = True
	for i in range(0, 26):
		if f[i] % n != 0:
			fl = False
			break
	if fl:
		print('YES')
	else:
		print('NO')


def farr(s):
	all_freq = {}
	for i in s:
		if i in all_freq:
			all_freq[i] += 1
		else:
			all_freq[i] = 1
	return all_freq

def nextInt():
	return int(input())

def intArr():
	arr = input().split(' ')
	return [int(x) for x in arr]

def op(arr, l):
	arr.sort()
	d = arr[l - 1]
	for i in range(0, l):
		arr[i] = d - arr[i]
	return
t = nextInt()
ans = []
for tt in range(t):
	n = nextInt()
	s = ''
	for x in range(n):
		s += input()
	work = True
	s = farr(s)
	for x in s:
		if s[x] % n != 0:
			work = False
	if work == True:
		ans.append('YES')
	else:
		ans.append('NO')
for x in ans:
	print(x)


import math
import collections
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2 ** 20)
t = 1
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	d = {}
	tot = 0
	for i in range(n):
		s = stdin.readline().strip('\n')
		for j in s:
			tot += 1
			if j not in d:
				d[j] = 0
			d[j] += 1
	chk = True
	if tot % n != 0:
		chk = False
	for i in d:
		if d[i] % n != 0:
			chk = False
			break
	if chk:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	count = [0 for i in range(26)]
	for j in range(n):
		line = input()
		for i in line:
			count[ord(i) - ord('a')] += 1
	check = True
	for i in count:
		if i % n != 0:
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ls = []
	d = dict()
	for i in range(n):
		ls.append(input())
	for item in ls:
		for i in item:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	for i in d.values():
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import defaultdict as dd
from sys import stdin, stdout
for t in range(int(stdin.readline().strip())):
	n = int(stdin.readline().strip())
	a = []
	for i in range(n):
		a.append(stdin.readline().strip())
	d = dd(int)
	for i in range(n):
		for s in a[i]:
			d[s] += 1
	v = list(d.values())
	flag = True
	for i in v:
		if i % n:
			flag = False
			break
	if flag:
		stdout.write('YES\n')
	else:
		stdout.write('NO\n')


t = int(input())
for k in range(0, t):
	n = int(input())
	l = {}
	for j in 'qwertyuiopasdfghjklzxcvbnm':
		l[j] = 0
	for j in range(0, n):
		u = input()
		for jj in u:
			l[jj] += 1
	c = 0
	for tt in l:
		if l[tt] % n == 0:
			c = c + 1
		else:
			break
	if c == 26:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = int(input())
	c = 26
	cnt = [0] * c
	k = []
	for i in range(l):
		k.append(input())
	for i in k:
		j = 0
		while j < len(i):
			cnt[ord(i[j]) - ord('a')] += 1
			j += 1
	f = 0
	for i in cnt:
		if i % l == 0:
			continue
		else:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')


from collections import Counter
p = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for _ in range(t):
	s = ''
	n = int(input())
	for i in range(n):
		temp = input()
		s = s + temp
	ans = Counter(s)
	for j in p:
		if ans[j] % n != 0:
			print('NO')
			break
		elif j == 'z':
			print('YES')


n = int(input())
for i in range(n):
	n1 = int(input())
	d1 = dict()
	for j in range(n1):
		st = list(input())
		for s in st:
			if s in d1:
				d1[s] += 1
			else:
				d1[s] = 1
	check = True
	for key in d1:
		if d1[key] % n1 != 0:
			check = False
	if check == True:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
checks = []
for test_case in range(test_cases):
	num_strings = int(input())
	strings = []
	for num_string in range(num_strings):
		items = list(input())
		for item in items:
			strings.append(item)
	diff_letters = [strings[0]]
	for letter in strings:
		if letter not in diff_letters:
			diff_letters.append(letter)
	num_letters = []
	for diff_letter in diff_letters:
		num_letters.append(strings.count(diff_letter))
	check1 = True
	for one_letter in num_letters:
		if one_letter < num_strings or one_letter % num_strings != 0:
			check1 = False
			break
	checks.append(check1)
for check in checks:
	if check == True:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	dp = [0] * 27
	for i in range(n):
		s = input()
		for i in s:
			dp[ord(i) - ord('a') + 1] += 1
	flag = 0
	for i in range(27):
		if dp[i] % n == 0:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')
	t = t - 1


T = int(input())
while T:
	num = int(input())
	chars = ''
	chash = {}
	for i in range(num):
		chars += input()
	for j in chars:
		if not j in chash:
			chash[j] = 0
		chash[j] += 1
	for (x, y) in chash.items():
		if y % num != 0:
			print('NO')
			break
	else:
		print('YES')
	T -= 1


import os
import sys
from io import BytesIO, IOBase
import threading
from collections import defaultdict, Counter
import heapq
from math import ceil, floor

def main():
	n = int(input())
	cnt = [0] * 26
	for i in range(n):
		s = input()
		for ch in s:
			cnt[ord(ch) - ord('a')] += 1
	ok = True
	for i in range(26):
		if cnt[i] % n:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(int(input())):
	main()


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	dd = defaultdict(int)
	for _ in range(n):
		s = input()
		for ss in s:
			dd[ss] += 1
	flg = False
	for (_, num) in dd.items():
		if num % n != 0:
			flg = True
			break
	if flg:
		print('NO')
	else:
		print('YES')


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	s = [input() for i in range(n)]
	d = defaultdict(int)
	for i in s:
		for j in i:
			d[j] += 1
	if all((i % n == 0 for i in d.values())):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	res = 0
	for c in set(s):
		if s.count(c) % n != 0:
			print('NO')
			res = 1
			break
	if not res:
		print('YES')


import math
cases = int(input())
for c in range(cases):
	strings = int(input())
	strs = []
	myCharMap = {}
	for s in range(strings):
		str = input()
		for anyS in str:
			if anyS in myCharMap:
				myCharMap[anyS] += 1
			else:
				myCharMap[anyS] = 1
	falseConsdition = False
	for val in myCharMap.values():
		if val % strings != 0:
			falseConsdition = True
			break
	if falseConsdition:
		print('NO')
	else:
		print('YES')


from collections import Counter, defaultdict
for _ in range(int(input())):
	n = int(input())
	ls = []
	d = defaultdict(int)
	for i in range(n):
		s = input()
		for j in s:
			d[j] += 1
	for k in d.values():
		if k % n != 0:
			print('NO')
			break
	else:
		print('YES')


for i in range(int(input())):
	letters = {}
	n = int(input())
	for i in range(n):
		s = input()
		for character in s:
			letters[character] = letters.get(character, 0) + 1
	for value in letters.values():
		if value % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	has1 = {}
	arr = []
	for i in range(n):
		string = input()
		arr.append(string)
		for j in string:
			if j not in has1:
				has1[j] = 1
			else:
				has1[j] += 1
	if n == 1:
		print('YES')
	else:
		for f in has1.values():
			if f % n != 0:
				print('NO')
				break
		else:
			print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	ans = [0 for i in range(26)]
	flag = 1
	for kk in range(n):
		a = input()
		for i in a:
			ans[ord(i) - 97] += 1
	for i in ans:
		if i % n != 0:
			flag = 0
	if flag:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	ar = []
	for i in range(n):
		temp = list(input())
		ar.extend(temp)
	s = set(ar)
	for i in s:
		if ar.count(i) % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	count = [0] * 26
	for i in range(n):
		s = input()
		for j in s:
			count[ord(j) - 97] += 1
	temp = 0
	for i in count:
		if i % n != 0:
			temp = 1
			break
	if temp == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	b = []
	flag = 0
	for _ in range(n):
		a = list(input())
		b = b + a
	c = []
	for i in b:
		if i not in c:
			if b.count(i) % n != 0:
				flag = 1
				break
			c.append(i)
	if flag == 1:
		print('NO')
	else:
		print('YES')


T = int(input())
while T != 0:
	N = int(input())
	a = [0] * 26
	for i in range(N):
		s = input()
		for i in s:
			a[ord(i) - ord('a')] += 1
	ans = 'YES'
	for i in range(26):
		if a[i] % N != 0:
			ans = 'NO'
			break
	print(ans)
	T -= 1


t = int(input())
for some_num in range(0, t):
	n = int(input())
	chars = {}
	for i in range(0, n):
		some_str = input()
		for k in some_str:
			if k in chars:
				chars[k] += 1
			else:
				chars[k] = 1
	flag = 0
	for i in chars:
		if chars[i] % n != 0:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


for i in range(int(input())):
	c = 1
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for i in s:
			if i not in d:
				d[i] = 1
			else:
				d[i] += 1
	for i in d:
		if d[i] % n != 0:
			c = 0
			break
	if c:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	dik = [0] * 26
	n = int(input())
	for _ in range(n):
		s = input()
		for w in s:
			if ord(w) == 13:
				break
			dik[ord(w) - ord('a')] += 1
	f = 0
	for i in dik:
		if i % n == 0:
			continue
		else:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


for t in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	ans = 'YES'
	A = 'abcdefghijklmnopqrstuvwxyz'
	l = [0] * 26
	for ch in A:
		cc = s.count(ch)
		if cc % n != 0:
			ans = 'NO'
			break
	print(ans)


inp = input()
letters = []
count = []
has = 0
no = 0
for i in range(int(inp)):
	letters = []
	count = []
	num = int(input())
	for k in range(num):
		stri = input()
		for ch in stri:
			has = 0
			for l in range(len(letters)):
				if ch == letters[l]:
					count[l] = int(count[l]) + 1
					has = 1
			if has == 0:
				letters.append(ch)
				count.append(1)
	no = 0
	for p in count:
		if p % num != 0:
			no = 1
	if no == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	s_lis = []
	for i in range(n):
		s_lis.append(list(input()))
	l = sum(s_lis, [])
	l2 = []
	for i in set(l):
		l2.append(l.count(i) % n)
	if sum(l2) == 0:
		print('YES')
	else:
		print('NO')


def process():
	n = int(input())
	li = [0] * 26
	for i in range(n):
		s = input()
		for j in s:
			t = ord(j) - ord('a')
			li[t] += 1
	for i in li:
		if i % n != 0:
			print('NO')
			return
	print('YES')
tests = int(input())
for i in range(tests):
	process()


for t in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l += list(input())
	ans = 'YES'
	for i in l:
		if l.count(i) % n != 0:
			ans = 'NO'
	print(ans)


TC = int(input())
for tc in range(TC):
	N = int(input())
	letters = {}
	for i in range(N):
		for s in input():
			letters[s] = letters.setdefault(s, 0) + 1
	is_ok = True
	for (k, v) in letters.items():
		if v % N != 0:
			is_ok = False
			break
	if is_ok:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	dic = {}
	for sentence in range(n):
		s = list(input())
		for i in s:
			if i not in dic:
				dic[i] = 0
			dic[i] += 1
	flag = True
	for i in dic:
		if dic[i] % n != 0:
			flag = False
			break
	if not flag:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	F = True
	n = int(input())
	letter = dict()
	strings = []
	for j in range(n):
		string = input()
		for char in string:
			letter[char] = letter.get(char, 0) + 1
	for cnt in letter.values():
		if cnt % n != 0:
			F = False
			break
	if F == True:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.buffer.readline
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
inst = lambda : input().decode().rstrip('\n\r')
from collections import deque as que, defaultdict as vector, Counter
_T_ = inin()
for _t_ in range(_T_):
	n = inin()
	ma = vector(int)
	for i in range(n):
		s = inst()
		for j in s:
			ma[j] += 1
	for i in ma:
		if ma[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
test = int(input())
while test > 0:
	test = test - 1
	n = int(input())
	li = []
	for i in range(n):
		s = input()
		for i in s:
			li.append(i)
	count = Counter(li)
	d = dict(count)
	for k in d:
		if d[k] % n != 0:
			flag = 1
			break
		else:
			flag = 0
	if flag == 1:
		print('NO')
	elif flag == 0:
		print('YES')


import math
t = int(input())
for w in range(t):
	l = [0] * 26
	n = int(input())
	for i in range(n):
		s = input()
		for j in s:
			l[ord(j) - ord('a')] += 1
	c = 1
	for i in l:
		if i % n != 0:
			c = 0
			break
	if c:
		print('YES')
	else:
		print('NO')


def do():
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	import collections
	c = collections.Counter(s)
	can = True
	for k in c.keys():
		if c[k] % n != 0:
			can = False
			break
	print('YES' if can else 'NO')
q = int(input())
for _ in range(q):
	do()


import math
import sys, collections
from sys import stdin, stdout

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w')

def is_subsequence(x, y):
	x = list(x)
	for letter in y:
		if x and x[0] == letter:
			x.pop(0)
	return not x

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret

def getFloor(A, x):
	(left, right) = (0, len(A) - 1)
	(ind, floor) = (-1, -1)
	while left <= right:
		mid = (left + right) // 2
		if x < A[mid]:
			right = mid - 1
		else:
			floor = A[mid]
			ind = mid
			left = mid + 1
	return ind

def check(st):
	n = len(st)
	digitSum = 0
	for i in range(0, n):
		digitSum = digitSum + int(st[i])
	return digitSum % 9 == 0

def isPowerOfTwo(n):
	if n == 0:
		return False
	while n != 1:
		if n % 2 != 0:
			return False
		n = n // 2
	return True

def kitte(n):
	c = 0
	while n != 0:
		n = n // 2
		c += 1
	return c

def aa(b, c):
	m = min(b, c)
	b -= m
	c -= m
	if c > 0 and b > 0:
		return m + (b + c) // 3
	else:
		return m

def bb(a, c):
	m = min(a, c)
	a -= m
	c -= m
	if c > 0 and a > 0:
		return m + (a + c) // 3
	else:
		return m

def cc(b, a):
	m = min(b, a)
	b -= m
	a -= m
	if a > 0 and b > 0:
		return m + (b + a) // 3
	else:
		return m

def findProductSum(A, n):
	array_sum = 0
	for i in range(0, n, 1):
		array_sum = array_sum + A[i]
	array_sum_square = array_sum * array_sum
	individual_square_sum = 0
	for i in range(0, n, 1):
		individual_square_sum += A[i] * A[i]
	return (array_sum_square - individual_square_sum) // 2

def transpose(a):
	b = a[:][:]
	N = len(a)
	for i in range(N):
		for j in range(N):
			b[i][j] = a[j][i]
	return b

def assign_rank_based_on_scores(a):
	final = []
	for ii in a:
		temp = ii[:]
		l = [1]
		temp.sort(reverse=True)
		for j in range(1, len(temp)):
			if temp[j] == temp[j - 1]:
				l.append(l[-1])
			else:
				l.append(j + 1)
		d = collections.defaultdict(int)
		j = 0
		for i in temp:
			d[i] = l[j]
			j += 1
		ans = []
		for j in ii:
			ans.append(d[j])
		final.append(ans)
	return final
mod = 10 ** 9 + 7

def main():
	for tt in range(int(input())):
		n = int(input())
		d = collections.defaultdict(int)
		for i in range(n):
			s = input()
			for j in s:
				d[j] += 1
		c = 0
		if n == 1:
			print('YES')
			continue
		for i in d:
			if d[i] % n != 0:
				c = 1
				break
		if c:
			print('NO')
		else:
			print('YES')
main()


from collections import defaultdict
for q in range(int(input())):
	n = int(input())
	d = defaultdict(int)
	for i in range(n):
		for j in input():
			d[j] += 1
	res = 'YES'
	for k in d.keys():
		if d[k] % n != 0:
			res = 'NO'
			break
	print(res)


from sys import stdin, stdout
from collections import Counter
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	d = {}
	flag = 1
	for _ in range(n):
		ctr = Counter(input())
		for (k, v) in ctr.items():
			d[k] = d.get(k, 0) + v
	for (k, f) in d.items():
		if f % n != 0:
			flag = 0
			break
	print('YES' if flag else 'NO')


def multiple_input():
	return map(int, input().split())

def list_input():
	return list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	flag = 0
	for i in d:
		if d[i] % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
for _ in range(int(input())):
	a = 'abcdefghijklmnopqrstuvwxyz'
	w = {}
	t = 1
	for i in range(26):
		w[a[i]] = 0
	r = int(input())
	for i in range(r):
		e = input()
		for j in e:
			w[j] += 1
	for i in a:
		if w[i] % r == 0:
			t = 1
		else:
			t = 0
			print('NO')
			break
	if t == 1:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = ''
	for x in range(n):
		s += input()
	lis = dict()
	for x in s:
		if x not in lis:
			lis[x] = 0
		lis[x] += 1
	count = list(lis.values())
	for x in range(len(count)):
		count[x] = count[x] % n
	count1 = [0 for x in count]
	if count == count1:
		print('YES')
	else:
		print('NO')


t = int(input())
for ex in range(t):
	n = int(input())
	letter_counter = dict()
	for i in range(n):
		s = input()
		for let in s:
			if let not in letter_counter.keys():
				letter_counter[let] = 1
			else:
				letter_counter[let] += 1
	possible = True
	for let in letter_counter.keys():
		if letter_counter[let] % n != 0:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def solution():
	N = int(input())
	count = [0] * 26
	for i in range(N):
		for k in input().rstrip():
			count[ord(k) - ord('a')] += 1
	flag = True
	for i in range(26):
		if count[i] % N != 0:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')
T = int(input())
for _ in range(T):
	solution()


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	m = n
	d = {}
	f = 0
	while n:
		s = input()
		for i in s:
			d[i] = d.get(i, 0) + 1
		n -= 1
	for each in d.values():
		if each % m != 0:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


T = int(input())
while T > 0:
	T -= 1
	d = [0] * 32
	n = int(input())
	for i in range(n):
		s = input()
		for j in s:
			d[ord(j) - ord('a')] += 1
	b = 0
	for i in range(32):
		if d[i] % n:
			b = 1
	if b:
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	n = int(input())
	dic = {}
	for i in range(n):
		s = input()
		for letter in s:
			if letter not in dic.keys():
				dic[letter] = 1
			else:
				dic[letter] = dic[letter] + 1
	l = []
	for v in dic.values():
		l.append(int(v))
	count = 0
	for item in l:
		if item % n == 0:
			count += 1
	if count == len(l):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for i in range(n):
		s = input()
		a.append(s)
	d = {}
	for i in range(len(a)):
		for j in range(len(a[i])):
			if a[i][j] in d:
				d[a[i][j]] += 1
			else:
				d[a[i][j]] = 1
	ans = 1
	for i in list(d.values()):
		if i % n != 0:
			ans = 0
			break
	if ans == 0:
		print('NO')
	else:
		print('YES')


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = []
	for i in range(n):
		a.append(input())
	b = [0] * 26
	for i in range(n):
		for j in a[i]:
			b[ord(j) - 97] += 1
	check = False
	for i in range(26):
		if b[i] % n != 0:
			check = True
			break
	if check:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	freq = {}
	for i in s:
		if i not in freq:
			freq[i] = 1
		else:
			freq[i] += 1
	printed = False
	for i in freq:
		if freq[i] % n != 0:
			print('NO')
			printed = True
			break
	if printed == False:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			d[j] = d.get(j, 0) + 1
	pre = -1
	flag = 0
	for i in d:
		if d[i] % n != 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
q = []
n = []
for i in range(t):
	l = []
	p = int(input())
	for j in range(p):
		u = list(map(str, input()))
		l.append(u)
	q.append(l)
	n.append(p)

def tully(n, los):
	f = []
	y = []
	for i in range(n):
		for j in range(len(los[i])):
			f.append(ord(los[i][j]) - 97)
	for i in range(max(f) + 1):
		y.append(0)
	for i in range(len(f)):
		y[f[i]] += 1
	for i in range(len(y)):
		if y[i] != 0 and y[i] % n != 0:
			return 0
	return 1
for i in range(t):
	r = tully(n[i], q[i])
	if r:
		print('YES')
	else:
		print('NO')


for _ in ' ' * int(input()):
	a = int(input())
	z = [0] * 26
	for _ in ' ' * a:
		k = input()
		for i in k:
			r = ord(i) - 97
			z[r] += 1
	ok = 1
	for i in range(26):
		if z[i] % a != 0:
			ok = 0
	if ok:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(n):
		s = input()
		a.append(s)
	f = {}
	for i in a:
		for j in i:
			if j not in f:
				f[j] = 1
			else:
				f[j] += 1
	ok = 1
	for key in f:
		if f[key] % n != 0:
			ok = 0
	if ok == 1:
		print('YES')
	else:
		print('NO')


def printResult(result):
	print('YES' if result else 'NO')

class JugglingLetters:

	def __init__(self):
		self.t = int(input())

	def start(self):
		for i in range(self.t):
			test = Test()
			result = test.start()
			printResult(result)

class Test:

	def __init__(self):
		self.n = int(input())
		self.strings = []
		for i in range(self.n):
			testString = input()
			self.strings.append(testString)

	def start(self):
		chars = {}
		for (_, string) in enumerate(self.strings):
			for (i, strChar) in enumerate(string):
				if chars.__contains__(strChar):
					chars[strChar] += 1
				else:
					chars[strChar] = 1
		return self.checkNumberChars(initialCharsNumber=self.n, chars=chars)

	def checkNumberChars(self, initialCharsNumber, chars):
		initialCharsNumber = self.n
		values = list(chars.values())
		for (_, el) in enumerate(values):
			if el != initialCharsNumber:
				if el % initialCharsNumber != 0:
					return False
		return True
program = JugglingLetters()
program.start()


for _ in range(int(input())):
	n = int(input())
	c = [0] * 27
	for i in range(n):
		s = input()
		for j in s:
			c[ord(j) - 96] += 1
	ch = True
	for i in c:
		if i % n != 0:
			ch = False
			break
	if ch:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for letter in s:
			if letter not in d:
				d[letter] = 0
			d[letter] += 1
	for val in d.values():
		if val % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
st = dict()

def test(s, n):
	temp = dict()
	for i in range(0, len(s)):
		temp[s[i]] = temp.get(s[i], 0) + 1
	flag = True
	for k in temp:
		if temp[k] % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')
for i in range(0, t):
	n = int(input())
	s = ''
	for j in range(0, n):
		s += input()
	st[s] = n
for i in st:
	test(i, st[i])


import math, queue, heapq
import sys
sys.setrecursionlimit(10 ** 6)
fastinput = sys.stdin.readline
fastout = sys.stdout.write
t = int(fastinput())
mod = 10 ** 9 + 7
while t:
	t -= 1
	n = int(fastinput())
	cnt = [0] * 26
	for i in range(n):
		for j in input():
			cnt[ord(j) - ord('a')] += 1
	ans = True
	for i in range(26):
		if cnt[i] % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	counts = defaultdict(lambda : 0)
	store = n
	while n > 0:
		n -= 1
		s = input().strip()
		for c in s:
			counts[c] += 1
	flag = True
	for key in counts:
		if counts[key] % store:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	d = {}
	l = []
	for j in range(n):
		l += list(input())
	a = 0
	for i in l:
		if i not in d:
			d[i] = l.count(i)
	for i in d:
		if d[i] % n != 0:
			a = 1
			break
	print('YES' if a == 0 else 'NO')


for _ in range(int(input())):
	n = int(input())
	chars = [0] * 26
	for i in range(n):
		s = input()
		for char in s:
			chars[ord(char) - 97] += 1
	for num in chars:
		if num != 0 and num % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import defaultdict, Counter
t = 1
t = int(input())
for _ in range(t):
	n = int(input())
	d = defaultdict(int)
	for _ in range(n):
		s = input()
		z = Counter(s)
		for key in list(z.keys()):
			d[key] += z[key]
	b = True
	for key in list(d.keys()):
		if d[key] % n != 0:
			b = False
	if b:
		print('YES')
	else:
		print('NO')


while True:
	try:
		t = eval(input())
		for i in range(t):
			n = eval(input())
			cnt = 0
			str1 = ''
			for j in range(n):
				str0 = input()
				str1 += str0
			list0 = list(str1)
			f = False
			for j in set(list0):
				if list0.count(j) % n != 0:
					f = True
					break
			if f:
				print('NO')
			else:
				print('YES')
	except:
		break


t = int(input())
while t:
	t = t - 1
	n = int(input())
	a = []
	s = ''
	f = []
	for i in range(n):
		a.append(input())
	for i in range(n):
		s += ''.join(a[i])
	for i in set(s):
		if s.count(i) % n == 0:
			f.append(1)
	if len(f) == len(set(s)):
		print('YES')
	else:
		print('NO')


import sys
from collections import Counter
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	M = [input().strip() for _ in range(n)]
	s = ''
	for i in M:
		s += i
	C = Counter(s)
	for i in C:
		if C[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


from __future__ import division, print_function
import os, sys
import math
import collections
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

class my_dictionary(dict):

	def __init__(self):
		self = dict()

	def add(self, key, value):
		self[key] = value

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def padded_bin_with_complement(x):
	if x < 0:
		return bin(2 ** 16 - abs(x))[2:].zfill(16)
	else:
		return bin(x)[2:].zfill(16)

def binaryToDecimal(binary):
	binary1 = binary
	(decimal, i, n) = (0, 0, 0)
	while binary != 0:
		dec = binary % 10
		decimal = decimal + dec * pow(2, i)
		binary = binary // 10
		i += 1
	print(decimal)

def CountFrequency(my_list):
	freq = {}
	for item in my_list:
		if item in freq:
			freq[item] += 1
		else:
			freq[item] = 1
	return freq

def pos(a):
	b = [0] * len(a)
	c = sorted(a)
	for i in range(len(a)):
		for j in range(len(a)):
			if c[j] == a[i]:
				b[i] = j
				break
	return b

def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n

def commonn(a, b, n):
	c = []
	for i in range(n):
		if a[i] == b[i]:
			c.append('-1')
		else:
			c.append(b[i])
	return c

def primeFactors(n):
	j = []
	while n % 2 == 0:
		j.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			j.append(int(n))
			n = n / i
	if n > 2:
		j.append(int(n))
	return j

def sumdigit(n):
	n = str(n)
	k = 0
	for i in range(len(n)):
		k += int(n[i])
	return k

def main():
	for _ in range(ii()):
		n = ii()
		a = []
		b = []
		f = 0
		for i in range(n):
			s = si()
			kl = list(s)
			a.append(kl)
		for i in range(n):
			for j in range(len(a[i])):
				b.append(a[i][j])
		k = CountFrequency(b)
		g = set(k)
		g = list(g)
		for i in range(len(k)):
			if k[g[i]] % n != 0:
				f = 1
		if f:
			print('NO')
		else:
			print('YES')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout
try:
	t = int(input())
	for _ in range(t):
		n = int(input())
		d = {}
		flag = 0
		for i in range(n):
			s = input()
			for j in range(len(s)):
				if s[j] in d:
					d[s[j]] += 1
				else:
					d[s[j]] = 1
		for i in d:
			if d[i] % n != 0:
				flag = 1
				break
		if flag == 1:
			print('NO')
		else:
			print('YES')
except:
	pass


import copy
t = int(input())
while t > 0:
	n = int(input())
	x = copy.copy(n)
	s = ''
	while x > 0:
		i = input()
		s = s + i
		x -= 1
	freq = {}
	for i in s:
		try:
			if freq[i] > 0:
				freq[i] += 1
		except:
			freq[i] = 1
	for i in freq:
		if freq[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')
	t -= 1


from collections import Counter
for i in range(int(input())):
	n = int(input())
	d = Counter()
	for i in range(n):
		d = d + Counter(input())
	flag = 1
	for i in d:
		if d[i] % n != 0:
			print('NO')
			flag = 0
			break
	if flag:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	fins = ''
	total_len = 0
	for i in range(n):
		s = input()
		fins += s
		total_len += len(s)
	if total_len % n != 0:
		print('NO')
	else:
		f = 0
		lst = list(fins)
		d = Counter(lst)
		for i in d.values():
			if i % n != 0:
				f = 1
				break
		if f == 1:
			print('NO')
		else:
			print('YES')


t = int(input())
for i in range(t):
	s = ''
	u = 'YES'
	n = int(input())
	for j in range(n):
		s += input()
	for i in set(s):
		if s.count(i) % n:
			u = 'NO'
			break
	print(u)


import sys
input = sys.stdin.readline

def inInt():
	return int(input())

def inStr():
	return input().strip('\n')

def inIList():
	return list(map(int, input().split()))

def inSList():
	return input().split()

def bsearch(nums, target):
	N = len(nums or [])
	l = 0
	r = N - 1
	while l <= r:
		mid = (l + r) // 2
		if nums[mid] < target:
			l = mid + 1
		elif nums[mid] > target:
			r = mid - 1
		else:
			return (None, mid, None)
	return (r if r >= 0 else None, None, l if l <= N - 1 else None)

def yesOrNo(val):
	print('YES' if val else 'NO')

def solve():
	ns = inInt()
	s = ''
	uq = ''
	enc = {}
	for i in range(ns):
		n = inStr()
		for c in n:
			if c in enc:
				continue
			enc[c] = True
			uq += c
		s += n
	for c in uq:
		if s.count(c) % ns != 0:
			return False
	return True
tests = inInt()
for case in range(tests):
	yesOrNo(solve())


for _ in range(int(input())):
	n = int(input())
	A = []
	for _ in range(n):
		A.append(input())
	dic = {}
	for s in A:
		for i in s:
			if i in dic:
				dic[i] += 1
			else:
				dic[i] = 1
	flag = True
	for (key, f) in dic.items():
		if f % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


from collections import Counter
for x in range(int(input())):
	c = Counter()
	m = int(input())
	for n in range(m):
		c.update(input())
	print('YES' if all(map(lambda a: a % m == 0, c.values())) else 'NO')


T = int(input())
for i in range(T):
	N = int(input())
	s = str('')
	flg = True
	for j in range(N):
		inp = input()
		s += inp
	for k in s:
		if s.count(k) % N != 0:
			flg = False
			break
	if flg:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	d = dict()
	n = int(input())
	tn = n
	while tn > 0:
		s = input()
		for c in s:
			if c not in d.keys():
				d[c] = 1
			else:
				d[c] += 1
		tn -= 1
	flag = True
	for v in d.values():
		if v % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	c = dict()
	for i in range(n):
		s = input()
		for i in range(len(s)):
			if s[i] in c:
				c[s[i]] += 1
			else:
				c[s[i]] = 1
	flag = True
	for j in c.values():
		if j % n != 0:
			flag = False
	if flag != True:
		print('NO')
	else:
		print('YES')


def count_char(strings):
	n = {}
	for i in strings:
		if i not in n:
			n[i] = 1
		else:
			n[i] += 1
	return n

def check_string(strings):
	n = {}
	for i in strings:
		c = count_char(i)
		for key in c:
			if key not in n:
				n[key] = c[key]
			else:
				n[key] += c[key]
	return n

def final(n, c):
	y = 'YES'
	no = 'NO'
	for key in n:
		if n[key] % c != 0:
			return no
	return y
t = int(input())
r = []
for i in range(t):
	n = int(input())
	strings = []
	for _ in range(n):
		s = input()
		strings.append(s)
	c = check_string(strings)
	r.append(final(c, n))
for i in r:
	print(i)


for t in range(int(input())):
	n = int(input())
	sl = []
	ln = 0
	s = ''
	for i in range(n):
		s1 = input()
		s = s + s1
	ln = len(s)
	char = 'a'
	while char <= 'z':
		c = 0
		for i in range(ln):
			if char == s[i]:
				c = c + 1
		sl.append(c)
		char = chr(ord(char) + 1)
	x = 0
	for i in range(len(sl)):
		if sl[i] % n != 0:
			print('NO')
			x = -1
			break
	if x != -1:
		print('YES')


for _ in range(int(input())):
	s = ''
	t = int(input())
	for i in range(t):
		s += input()
	a = list(s)
	b = set(a)
	n = len(b)
	k = 0
	for i in b:
		if a.count(i) % t == 0:
			k += 1
	if k == n:
		print('YES')
	else:
		print('NO')


def juggling(n):
	(ss, news) = ('', '')
	for i in range(n):
		ss = input()
		news += ss
	l = []
	for i in set(news):
		l.append(news.count(i))
	c = 0
	for i in l:
		if i % n == 0:
			c += 1
	if c == len(l):
		return 'YES'
	return 'NO'
tc = int(input())
for i in range(tc):
	n = int(input())
	print(juggling(n))


t = int(input())
while t:
	n = int(input())
	mem = {}
	for i in range(n):
		s = input()
		for c in s:
			if c in mem:
				mem[c] += 1
			else:
				mem[c] = 1
	ans = 'YES'
	for v in mem.values():
		if v % n != 0:
			ans = 'NO'
			break
	print(ans)
	t -= 1


def main(n):
	s_list = []
	for i in range(n):
		s = input()
		s_list.append(s)
	d = dict()

	def cnt(s):
		for e in s:
			if e not in d.keys():
				d[e] = 1
			else:
				d[e] += 1
	for s in s_list:
		cnt(s)
	flag = True
	for v in d.values():
		if v % n != 0:
			flag = False
	return flag
t = int(input())
for i in range(t):
	n = int(input())
	if main(n):
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	li = []
	for i in range(n):
		li += list(str(input()))
	c = Counter(li)
	flag = 0
	for j in set(li):
		if c[j] % n != 0:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


for i in range(int(input())):
	n = int(input())
	ls = []
	for i in range(n):
		ls += input()
	ss = set(ls)
	for i in ss:
		if ls.count(i) % n != 0:
			print('NO')
			break
	else:
		print('YES')


import sys
for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for x in s:
			d[x] = d.get(x, 0) + 1
	bad = False
	for x in d:
		if d[x] % n != 0:
			bad = True
	print('NO' if bad else 'YES')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	s = {}
	for _ in range(n):
		a = input().rstrip()
		for i in a:
			if i not in s:
				s[i] = 0
			s[i] += 1
	res = 'YES'
	for i in s.values():
		if i % n != 0:
			res = 'NO'
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	d = {}
	for j in range(n):
		s = input()
		for w in s:
			if w not in d:
				d[w] = 1
			else:
				d[w] += 1
	ans = 'YES'
	for k in d:
		if d[k] % n != 0:
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	Str = ''
	dic = {}
	for i in range(n):
		Str = input()
		for Char in Str:
			try:
				dic[Char] += 1
			except:
				dic[Char] = 1
	is_pos = True
	for Char in dic:
		if dic[Char] % n != 0:
			is_pos = False
			break
	if is_pos:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	a = ''
	for i in range(n):
		a1 = input()
		a += a1
	freq = {}
	for i in a:
		if i in freq:
			freq[i] += 1
		else:
			freq[i] = 1
	count = 0
	for key in freq:
		if freq[key] % n != 0:
			count = -1
	if count < 0:
		print('NO')
	else:
		print('YES')


t = int(input())
count = 0
flag = 1
while t:
	n = int(input())
	n_aux = n
	words = ''
	for i in range(n):
		words += input()
	words = ''.join(sorted(words))
	nn_aux = 0
	flag = 1
	tam = len(words)
	for j in range(0, tam, n_aux):
		nn_aux += n_aux
		if tam % n_aux != 0:
			flag = 0
		for k in range(j, nn_aux):
			if words[j] != words[k]:
				flag = 0
				break
		if flag == 0:
			break
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		n = ii()
		s = []
		for i in range(n):
			s.append(si())
		f = [0] * 26
		for i in range(n):
			for j in range(len(s[i])):
				f[abd[s[i][j]]] += 1
		flag = 1
		for i in range(26):
			if f[i] % n != 0:
				flag = 0
				break
		if flag:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	n = int(input())
	s = []
	for i in range(n):
		st = input()
		s.append(st)
	d = {}
	for x in s:
		for j in x:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	t = 0
	for x in d:
		if d[x] % n != 0:
			t = 1
			break
	if t == 1:
		print('NO')
	else:
		print('YES')


import collections
t = int(input())
while t > 0:
	n = int(input())
	inpstr = ''
	for i in range(n):
		tmp = input()
		inpstr = inpstr + tmp
	lst = list(inpstr)
	freq = dict(collections.Counter(lst))
	flag = False
	dic_val = list(freq.values())
	for i in dic_val:
		if i != n and i % n != 0:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')
	t -= 1


def solve(s, n):
	se = set(s)
	for x in se:
		if s.count(x) % n != 0:
			return False
	return True
t = int(input())
for i in range(t):
	n = int(input())
	s = ''
	for j in range(n):
		s += input()
	if solve(s, n):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	num_strings = int(input())
	num_chars = [0] * 26
	for j in range(num_strings):
		a = input()
		for k in a:
			k = ord(k) - 97
			num_chars[k] += 1
	for h in num_chars:
		if h % num_strings != 0:
			print('NO')
			break
	else:
		print('YES')


import sys
t = int(input())
for test_case in range(t):
	n_string = int(input())
	alpha = [0] * 26
	no = False
	for _ in range(n_string):
		for ch in list(sys.stdin.readline().rstrip()):
			alpha[ord(ch) - ord('a')] += 1
	for i in range(26):
		if alpha[i] % n_string != 0:
			no = True
			break
	if no:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = []
	flag = 1
	for i in range(0, n):
		e = input()
		s.append(e)
	chars = [0] * 26
	for i in range(0, len(s)):
		for j in range(0, len(s[i])):
			v = ord(s[i][j])
			chars[v - 97] += 1
	for i in range(0, 26):
		if chars[i] % n != 0:
			flag = 0
	if flag == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = []
	for _ in range(n):
		s = str(input())
		arr.append(s)
	d = {}
	for i in arr:
		for c in i:
			if c not in d:
				d[c] = 1
			else:
				d[c] += 1
	flag = 1
	for i in d.values():
		if i % n != 0:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


for i in range(0, int(input())):
	n = int(input())
	s = ''
	for j in range(0, n):
		s += input()
	w = 0
	s = list(s)
	for j in s:
		if s.count(j) % n != 0:
			print('NO')
			w = 1
			break
	if w == 0:
		print('YES')


def solve():
	mp = {}
	n = int(input())
	for i in range(n):
		s = input()
		for c in s:
			mp.setdefault(c, 0)
			mp[c] += 1
	for v in mp.values():
		if v % n != 0:
			print('NO')
			return
	print('YES')
t = int(input())
for _ in range(t):
	solve()


T = int(input())
for t in range(T):
	N = int(input())
	d = {}
	for n in range(N):
		s = input()
		for i in s:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	ans = True
	for key in d:
		if d[key] % N != 0:
			ans = False
			break
	if ans == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = [0 for _ in range(26)]
	for _ in range(n):
		s = input()
		for ll in s:
			l[ord(ll) - ord('a')] += 1
	sol = True
	for i in l:
		if i % n != 0:
			sol = False
			break
	print('YES' if sol else 'NO')


t = int(input())
mainstr = 'abcdefghijklmnopqrstuvwxyz'
for i in range(t):
	n = int(input())
	a = []
	for j in range(n):
		a.append(input())
	vamos = []
	for j in range(len(mainstr)):
		vamos.append(0)
	for j in range(len(mainstr)):
		for k in range(n):
			vamos[j] = vamos[j] + a[k].count(mainstr[j])
	for j in range(len(mainstr)):
		if vamos[j] % n != 0:
			print('NO')
			break
		elif j == len(mainstr) - 1:
			print('YES')


t = int(input())
for oo in range(t):
	n = int(input())
	niz = [0] * 26
	for ww in range(n):
		s = input()
		for j in range(len(s)):
			m = s[j]
			niz[ord(m) - 97] += 1
	bul = True
	for i in range(0, 26):
		e = niz[i]
		if e % n != 0:
			bul = False
			break
	if bul:
		print('YES')
	else:
		print('NO')


def solve(n, d):
	for (i, j) in d.items():
		if j % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	d = dict()
	for _ in range(n):
		s = input()
		for i in s:
			if i in d.keys():
				d[i] += 1
			else:
				d[i] = 1
	print(solve(n, d))


for _ in range(int(input())):
	n = int(input())
	a = []
	f = 0
	for i in range(n):
		a.append(input())
	alpha = [0] * 26
	for i in range(n):
		for j in range(len(a[i])):
			alpha[ord(a[i][j]) - 97] += 1
	for i in range(26):
		if alpha[i] % n != 0:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	dictionary = {}
	for j in range(n):
		str = input()
		for chr in str:
			if chr in dictionary:
				dictionary[chr] = dictionary[chr] + 1
			else:
				dictionary[chr] = 1
	okay = True
	for val in dictionary.values():
		if val % n != 0:
			okay = False
	if okay:
		print('YES')
	else:
		print('NO')


t = int(input())
for case in range(t):
	n = int(input())
	cnt = {}
	for i in range(n):
		s = input()
		for c in s:
			if c not in cnt:
				cnt[c] = 1
			else:
				cnt[c] += 1
	possible = True
	for c in cnt:
		if cnt[c] % n != 0:
			possible = False
	if possible:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	dictn = {}
	for j in range(0, n):
		st = input()
		for c in st:
			try:
				dictn[c] += 1
			except:
				dictn[c] = 1
	check = 0
	for key in list(dictn.keys()):
		if dictn[key] % n != 0:
			print('NO')
			check = 1
			break
	if check == 0:
		print('YES')


n = int(input())
for i in range(n):
	s = int(input())
	li = []
	f = 0
	for j in range(s):
		k = input().lower()
		for p in k:
			li.append(p)
	li = sorted(li)
	for g in li:
		if li.count(g) % s != 0:
			f = 1
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	x = int(input())
	s1 = ''
	for j in range(0, x):
		s = str(input())
		s1 += s
	dict1 = {i: s1.count(i) for i in s1}
	count = 0
	for i in dict1:
		ans = dict1[i] / x
		if ans == int(ans):
			continue
		else:
			print('NO')
			count = 1
			break
	if count == 0:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	for _ in range(n):
		x = input()
		for i in x:
			d[i] = d.get(i, 0) + 1
	for i in d.values():
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


from sys import setrecursionlimit, stdin
t = int(input())
for i in range(t):
	n = int(input())
	d = {}
	a = []
	f = 0
	for j in range(n):
		s = stdin.readline().strip()
		for v in s:
			if v in d:
				d[v] += 1
			else:
				d[v] = 1
	for v in d:
		if d[v] % n != 0:
			f = 1
	if f == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter

def solve(p, n):
	for j in p:
		if p[j] % n != 0:
			return 'NO'
	return 'YES'
for j in range(int(input())):
	n = int(input())
	ans = ''
	for i in range(n):
		ans += input()
	p = Counter(ans)
	print(solve(p, n))


def solve():
	n = int(input())
	d = {}
	for i in range(n):
		for c in input():
			if c not in d:
				d[c] = 1
			else:
				d[c] += 1
	for c in d:
		if d[c] % n != 0:
			print('NO')
			return
	print('YES')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	d = {}
	for j in range(n):
		s = input()
		l.append(s)
	for j in range(n):
		for k in range(len(l[j])):
			if l[j][k] not in d:
				d[l[j][k]] = 0
			d[l[j][k]] += 1
	for j in d:
		if d[j] % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	k = n
	a = [0] * 26
	while n:
		n -= 1
		s = input()
		for x in s:
			a[ord(x) - 97] += 1
	for x in a:
		if x % k != 0:
			print('NO')
			break
	else:
		print('YES')


def string_test(string_list, n):
	string_dict = {}
	for string in string_list:
		for char in string:
			if char in string_dict:
				string_dict[char] += 1
			else:
				string_dict[char] = 1
	for char in string_dict:
		if string_dict[char] % n != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	string_list = []
	for _ in range(n):
		string_list.append(input())
	print(string_test(string_list, n))


ans = []
k = int(input())
for _ in range(k):
	isDone = True
	t = int(input())
	l = [0 for i in range(26)]
	for _ in range(t):
		s = input()
		for c in s:
			l[ord(c) - 97] += 1
	for n in l:
		if n % t != 0:
			isDone = False
	if isDone:
		ans.append('YES')
	else:
		ans.append('NO')
for a in ans:
	print(a)


for i in range(int(input())):
	(s, counter, S) = ('', 0, int(input()))
	for j in range(S):
		x = str(input())
		s += x
	y = list(set(s))
	for k in y:
		if s.count(k) % S != 0:
			counter += 1
			break
	print('YES' if counter == 0 else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	flag = 0
	for i in range(n):
		s = list(input())
		for j in s:
			if j not in d:
				d[j] = 1
			else:
				d[j] += 1
	for j in d:
		if d[j] % n != 0:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


test = int(input())
for _ in range(test):
	d = dict()
	n = int(input())
	for _ in range(n):
		s = input()
		for each in s:
			if each in d:
				d[each] = d[each] + 1
			else:
				d[each] = 1
	flag = 0
	for each in d:
		if d[each] % n != 0:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


import sys
import math
from collections import Counter, defaultdict
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
S = lambda : input()

def case():
	n = IN()
	d = Counter()
	for i in range(n):
		d += Counter(input())
	for i in d:
		if d[i] % n:
			print('NO')
			return
	print('YES')
for _ in range(IN()):
	case()


t = int(input())
while t:
	t = t - 1
	n = int(input())
	d = dict()
	for i in range(n):
		s = input()
		for j in s:
			d[j] = d.get(j, 0) + 1
	flag = 1
	for i in d.values():
		if i % n:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	s = int(input())
	arr = []
	d = {}
	for i in range(s):
		x = input()
		arr.append(x)
	for i in arr:
		for j in i:
			if j not in d:
				d[j] = 1
			else:
				d[j] += 1
	flag = 0
	for i in d.values():
		if i < s:
			flag = 1
			break
		if i % s == 0 or s % i == 0:
			pass
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


import collections as c

def solve():
	for y in x:
		if x[y] % N != 0:
			return 'NO'
	return 'YES'
T = int(input())
for t in range(1, T + 1):
	N = int(input())
	x = c.defaultdict(int)
	for n in range(N):
		S = input()
		for s in S:
			x[s] += 1
	print(solve())


for t in range(int(input())):
	n = int(input())
	s = ''
	knt = 0
	for i in range(n):
		s += input()
	freq = {}
	for i in s:
		if i in freq:
			freq[i] += 1
		else:
			freq[i] = 1
	for i in freq.values():
		if i % n != 0:
			knt = 1
			break
	if knt == 1:
		print('NO')
	else:
		print('YES')


aa = int(input())
for ii in range(aa):
	bb = int(input())
	dd = 'abcdefghijklmnopqrstuvwxyz'
	a = []
	b = []
	for i in range(bb):
		c = input()
		for j in c:
			a.append(dd.find(j))
			if dd.find(j) in b:
				pass
			else:
				b.append(dd.find(j))
	xxx = 0
	for k in b:
		x = a.count(k)
		if x // bb == x / bb:
			pass
		else:
			xxx = 1
	if xxx == 0:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
for _ in range(int(input())):
	litery = defaultdict(int)
	n = int(input())
	for _ in range(n):
		for x in input():
			litery[x] += 1
	for x in litery.values():
		if x % n != 0:
			print('NO')
			break
	else:
		print('YES')


import math
from sys import stdin
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(n,) = gil()
	char = {}
	for _ in range(n):
		for ch in g():
			char[ch] = char.get(ch, 0) + 1
	flag = True
	for ch in char:
		if char[ch] % n:
			flag = False
			break
	print('YES' if flag else 'NO')


import string
t = int(input())
while t > 0:
	n = int(input())
	b = 'abcdefghijklmnopqrstuvwxyz'
	a = dict.fromkeys(b, 0)
	for i in range(n):
		s = input()
		m = len(s)
		for j in range(m):
			a[s[j]] += 1
	flag = 0
	for i in a:
		if a[i] % n != 0:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')
	t -= 1


from collections import Counter

def main():
	n = int(input())
	cnt = Counter()
	for _ in range(n):
		cnt.update(input())
	for v in cnt.values():
		if v % n != 0:
			print('NO')
			return
	print('YES')
t = int(input())
for _ in range(t):
	main()


t = int(input())
for _ in range(t):
	cnt = [0] * 26
	n = int(input())
	for i in range(n):
		s = input()
		for j in range(len(s)):
			cnt[int(ord(s[j]) - ord('a'))] += 1
	pos = True
	for i in range(26):
		if cnt[i] % n:
			pos = False
			break
	print('YES') if pos else print('NO')


for _ in range(int(input())):
	n = int(input())
	letters = [0 for _ in range(256)]
	for _ in range(n):
		for l in input():
			letters[ord(l)] += 1
	result = True
	for x in letters:
		if x % n != 0:
			result = False
			break
	print('YES' if result else 'NO')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	d = defaultdict(int)
	f = 0
	for i in range(n):
		s = input()
		for j in s:
			d[j] += 1
	for i in d:
		if d[i] % n != 0:
			f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
output = []
for i in range(t):
	n = int(input())
	lst = []
	for j in range(n):
		s = input()
		lst.append(s)
	l = []
	for item in lst:
		for ch in item:
			l.append(ch)
	d = dict()
	for item in l:
		count = l.count(item)
		if item not in d.keys():
			d[item] = count
	for key in d.keys():
		if d[key] % n == 0:
			d[key] = 'YES'
		else:
			d[key] = 'NO'
	temp = set(d.values())
	if len(temp) == 1 and list(temp)[0] == 'YES':
		output.append('YES')
	else:
		output.append('NO')
for item in output:
	print(item)


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10 ** 6)
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	ans = ''
	for _ in range(ii()):
		n = ii()
		d = defaultdict(int)
		for i in range(n):
			s = I()
			for k in s:
				d[k] += 1
		flag = 1
		for i in d:
			if d[i] % n != 0:
				flag = 0
				break
		if flag:
			ans += 'YES' + '\n'
		else:
			ans += 'NO\n'
	print(ans)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	sigh = {}
	ans = 'YES'
	for k in range(n):
		s = input()
		for i in s:
			if i not in sigh:
				sigh[i] = 1
			else:
				sigh[i] += 1
	for j in sigh.values():
		if j % n != 0:
			ans = 'NO'
			break
	print(ans)


from collections import Counter

def juggling(n, arr):
	flag = True
	s = ''
	for i in arr:
		s += i
	c = Counter(s)
	for i in c:
		if c[i] != 0:
			if c[i] % n == 0:
				pass
			else:
				flag = False
				break
	if flag:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for _ in range(t):
	n = int(input())
	li = []
	for i in range(n):
		li.append(str(input()))
	print(juggling(n, li))


test = int(input())
for Test in range(test):
	n = int(input())
	d = {}
	for j in range(n):
		s = input()
		for i in s:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	z = 'YES'
	for i in d:
		if d[i] % n != 0:
			z = 'NO'
	print(z)


t = int(input())
for _ in range(t):
	n = int(input())
	m = []
	dic = {}
	for i in range(n):
		s = input()
		for j in range(len(s)):
			if s[j] in dic:
				dic[s[j]] += 1
			else:
				dic[s[j]] = 1
	flag = 0
	for i in dic:
		if dic[i] % n != 0:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


for _ in range(int(input())):
	x = int(input())
	d = {}
	false = 0
	for i in range(x):
		a = input()
		for j in a:
			if d.get(j):
				d[j] += 1
			else:
				d[j] = 1
	for i in d.values():
		if i % x != 0:
			false = 1
			break
	if false == 0:
		print('YES')
	else:
		print('NO')


for _ in [0] * int(input()):
	n = int(input())
	dic = {}
	for a in range(n):
		arr = list(input())
		for i in arr:
			if i not in dic:
				dic[i] = 1
			else:
				dic[i] += 1
	ans = True
	for key in dic:
		if dic[key] % n != 0:
			ans = False
			break
	if ans == True:
		print('YES')
	else:
		print('NO')


from collections import Counter

def probA(arr):
	n = len(arr)
	st = ''
	for i in arr:
		st += i
	temp = Counter(st)
	for (i, j) in temp.items():
		if j % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	for j in range(n):
		s = input()
		arr.append(s)
	print(probA(arr))


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	es = ''
	for __ in range(n):
		es += input()
	cntr = Counter(es)
	for val in cntr.values():
		if val % n != 0:
			print('NO')
			break
	else:
		print('YES')


def li():
	return list(map(int, input().split()))

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())
for _ in range(ii()):
	n = ii()
	d = {}
	s = []
	for i in range(n):
		v = input()
		s.append(v)
		for i in range(len(v)):
			d[v[i]] = 0
	for i in range(n):
		for j in range(len(s[i])):
			d[s[i][j]] += 1
	for key in d.keys():
		if d[key] % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(0, int(input())):
	n = int(input())
	list1 = []
	s1 = ''
	for _ in range(n):
		s = input()
		s1 = s1 + s
	freq1 = {}
	for i in s1:
		if i in freq1:
			freq1[i] += 1
		else:
			freq1[i] = 1
	c = 0
	list1 = list(freq1.values())
	for j in list1:
		if j % n != 0:
			c = 1
			break
	if c == 1:
		print('NO')
	else:
		print('YES')


def juggle(n, s_list):
	map = {}
	for s in s_list:
		for c in s:
			map[c] = map.get(c, 0) + 1
	for (key, value) in map.items():
		if value % n != 0:
			return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	list = []
	for i in range(n):
		list.append(input())
	if juggle(n, list):
		print('YES')
	else:
		print('NO')


from collections import Counter
for x in range(int(input())):
	n = int(input())
	l = []
	for y in range(n):
		a = input()
		l += list(a)
	nl = Counter(l)
	for x in set(nl.values()):
		if x % n != 0:
			print('NO')
			break
	else:
		print('YES')


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * (2 * 10 ** 5 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(2 * 10 ** 5 + 5):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj
mod = 10 ** 9 + 7

def solve():
	d = {}
	n = II()
	for i in range(n):
		s = input()
		for ele in s:
			d[ele] = d.get(ele, 0) + 1
	for ele in d:
		if d[ele] % n != 0:
			print('NO')
			return
	P('YES')
	return
t = II()
for i in range(t):
	solve()


for _ in range(int(input())):
	flag = 0
	n = int(input())
	a = ''
	for i in range(n):
		a = a + input()
	if len(a) % n != 0:
		print('NO')
	else:
		for j in set(a):
			if not (a.count(j) % n == 0 or a.count(j) == 0):
				print('NO')
				flag = 1
				break
		if flag == 0:
			print('YES')


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = 10 ** 9 + 7

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = defaultdict(int)
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors[i] += 1
			n //= i
		i += 1
	if n > 1:
		factors[n] += 1
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def a():
	n = int(input())
	m = defaultdict(int)
	for i in range(n):
		s = input()
		for c in s:
			m[c] += 1
	res = 'YES'
	for c in m:
		if m[c] % n != 0:
			res = 'NO'
			break
	print(res)

def b():
	n = int(input())
	arr = array()
	arr.sort()
	maxi = arr[-1]
	res1 = math.floor(maxi ** (1 / (n - 1)))
	res2 = math.ceil(maxi ** (1 / (n - 1)))
	ans1 = ans2 = 0
	for i in range(n):
		ans1 += abs(arr[i] - res1 ** i)
	for i in range(n):
		ans2 += abs(arr[i] - res2 ** i)
	print(min(ans1, ans2))
t = 1
t = int(input())
for _ in range(t):
	a()


import os
import sys
from io import BytesIO, IOBase
from collections import Counter

def solution(words, n):
	counts = Counter(words)
	res = all((y % n == 0 for (x, y) in counts.items()))
	write('YES' if res else 'NO')

def main():
	for _ in range(r_int()):
		n = r_int()
		words = []
		for _ in range(n):
			s = input()
			words.append(s)
		solution(''.join(words), n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


t = int(input())
while t:
	ll = []
	n = int(input())
	for i in range(n):
		s = input()
		l = list(s)
		ll.extend(l)
	mdict = {i: ll.count(i) for i in ll}
	count = 0
	for x in mdict.values():
		if x % n == 0:
			count += 1
	if count == len(mdict):
		print('YES')
	else:
		print('NO')
	t -= 1


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, A):
	freq = Counter()
	for S in A:
		for x in S:
			freq[x] += 1
	if all((v % N == 0 for (k, v) in freq.items())):
		return 'YES'
	return 'NO'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(N,) = [int(x) for x in input().split()]
	A = [input().decode().rstrip() for i in range(N)]
	ans = solve(N, A)
	print(ans)


from collections import Counter
for nt in range(int(input())):
	n = int(input())
	a = ''
	for i in range(n):
		a += input()
	c = Counter(a)
	ans = 'YES'
	for i in c:
		if c[i] % n != 0:
			ans = 'NO'
	print(ans)


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	strings = []
	for j in range(n):
		s = input()
		for k in s:
			strings.append(k)
	t = Counter(strings)
	flag = 0
	for i in t.values():
		if i % n != 0:
			flag = 1
	print('YES') if flag == 0 else print('NO')


from collections import Counter
import sys
t = int(input())
while t > 0:
	n = int(input())
	d = ''
	for i in range(n):
		s = input()
		d += s
	c = Counter(d)
	f = len(c)
	ff = list(c.values())
	ss = 0
	for i in range(f):
		if ff[i] % n == 0:
			ss += 1
		else:
			print('NO')
			break
	if ss == f:
		print('YES')
	t -= 1


convert = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
for i in range(int(input())):
	letters = [0] * 26
	n = int(input())
	for i in range(n):
		s = input().strip()
		for char in s:
			letters[convert[char]] += 1
	check = True
	for letter in letters:
		if letter % n != 0:
			check = False
	print('YES') if check else print('NO')


for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	ans = True
	for i in list(d.values()):
		if i % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


def check(sum1, n):
	a = list(Counter(sum1).values())
	for i in a:
		if i % n != 0:
			return 'NO'
	return 'YES'
from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	sum1 = ''
	for i in range(n):
		s = input()
		sum1 += s
	print(check(sum1, n))


from sys import stdin
ip = stdin.readline
for _ in range(int(ip())):
	n = int(ip())
	idx = lambda x: ord(x) - 97
	freq = [0] * 26
	for _ in range(n):
		for i in ip().strip():
			freq[idx(i)] += 1
	flag = True
	for i in freq:
		if not i % n == 0:
			flag = False
			break
	print('YES' if flag else 'NO')


def JugglingLetters(strings):
	hash = {}
	for item in strings:
		for char in item:
			if hash.get(char) == None:
				hash[char] = 1
			else:
				hash[char] += 1
	for charCount in hash:
		if hash.get(charCount) < len(strings) or hash.get(charCount) % len(strings) != 0:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(0, t):
	t = int(input())
	arr = [input() for s in range(t)]
	print(JugglingLetters(arr))


n = int(input())
while n > 0:
	n -= 1
	t = int(input())
	a = []
	for i in range(t):
		a.append(input())
	d = {}
	for i in range(len(a)):
		for j in range(len(a[i])):
			if a[i][j] in d:
				d[a[i][j]] += 1
			else:
				d[a[i][j]] = 1
	ch = 0
	for i in d:
		if d[i] % t != 0:
			ch = 1
			break
	if ch == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	hm = {}
	for i in range(n):
		s = input()
		for ch in s:
			if ch not in hm:
				hm[ch] = 0
			hm[ch] += 1
	ans = 'YES'
	for k in hm.keys():
		if hm[k] % n != 0:
			ans = 'NO'
			break
	print(ans)


T = int(input())
for t in range(T):
	n = int(input())
	l = []
	flag = 'YES'
	for i in range(n):
		l = l + list(input())
	for i in set(l):
		if l.count(i) % n != 0:
			flag = 'NO'
	print(flag)


for _ in range(int(input())):
	N = int(input())
	X = [0] * 26
	for i in range(N):
		for s in input():
			X[ord(s) - 97] += 1
	if all((x % N == 0 for x in X)):
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	s = []
	for i in range(0, n):
		temp = input()
		s.append(temp)
	d1 = {}
	for sent in s:
		for i in sent:
			if i not in list(d1.keys()):
				d1[i] = 1
			else:
				d1[i] = d1[i] + 1
	check = 0
	for i in list(d1.keys()):
		if d1[i] % n:
			check = 1
	if check:
		print('NO')
	else:
		print('YES')
	t = t - 1


n = int(input())
for i in range(n):
	k = int(input())
	g = 0
	l = list()
	for j in range(k):
		l.append(input())
	from string import ascii_lowercase
	for c in ascii_lowercase:
		m = 0
		for x in l:
			m = m + x.count(c)
		if m % k == 0 or m == 0:
			g = g + 1
	if g == 26:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	X = [0] * 26
	for i in range(n):
		s = str(input())
		for j in range(len(s)):
			X[ord(s[j]) - ord('a')] += 1
	for i in range(26):
		if X[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


letter = list(map(chr, range(ord('a'), ord('z') + 1)))
for _ in range(int(input())):
	n = int(input())
	all = ''
	dict = {}
	for i in letter:
		dict[i] = 0
	for i in range(n):
		s = input()
		for le in s:
			dict[le] += 1
	fl = 1
	for i in letter:
		if dict[i] != 0:
			if dict[i] % n != 0:
				fl = 0
				break
	if fl == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
l = []
while t > 0:
	n = int(input())
	str = ''
	for i in range(n):
		test = input()
		str += test
	res = {}
	for keys in str:
		res[keys] = res.get(keys, 0) + 1
	res1 = list(res.values())[0]
	if res1 % n != 0:
		l.append('NO')
		t -= 1
		continue
	all_equal = all((value % n == 0 for value in res.values()))
	if all_equal is True:
		l.append('YES')
	else:
		l.append('NO')
	t -= 1
for i in range(len(l)):
	print(l[i])


t = int(input())
for a in range(t):
	n = int(input())
	dict = {}
	result = []
	for i in range(n):
		s = str(input())
		result.append(s)
	for i in range(n):
		for j in range(len(result[i])):
			h = dict.get(result[i][j])
			if dict.get(result[i][j]) is not None:
				dict.update({result[i][j]: h + 1})
			else:
				dict.update({result[i][j]: 0})
	u = 0
	for i in dict.items():
		if (i[1] + 1) % n != 0:
			print('NO')
			u = 1
			break
	if not u:
		print('YES')


from collections import Counter
for i in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	c = Counter(s)
	flag = True
	for i in c.values():
		if i % n:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	s = ''
	n = int(input())
	for a in range(n):
		s += input()
	count = [0] * 26
	for i in range(26):
		count[i] = s.count(chr(97 + i))
	if all((e % n == 0 for e in count)) == True:
		print('YES')
	else:
		print('NO')


from collections import Counter
t = int(input())
for x in range(t):
	n = int(input())
	string = ''
	for i in range(n):
		s = str(input())
		string += s
	flag = 0
	length = len(string)
	count = [0] * 26
	for i in range(length):
		count[ord(string[i]) - ord('a')] += 1
	count.sort()
	for i in range(26):
		if count[i] % n != 0:
			flag = 0
			break
		else:
			flag = 1
	if flag == 0:
		print('NO')
	else:
		print('YES')


for cases in range(int(input())):
	n = int(input())
	characters = {}
	for strings in range(n):
		string = input()
		for i in string:
			characters[i] = characters.get(i, 0) + 1
	status = True
	for value in characters.values():
		if value % n != 0:
			status = False
			break
	if status:
		print('YES')
	else:
		print('NO')


t = int(input())
for rr in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s = s + input()
	d = {}
	flag = 0
	for i in s:
		d[i] = d.get(i, 0) + 1
	if len(s) % n == 0:
		for (i, j) in d.items():
			if j % n == 0:
				flag = 1
			elif j % n != 0:
				flag = 0
				break
	if flag == 0:
		print('NO')
	elif flag == 1:
		print('YES')


t = int(input())
lettermap = {}
output = []
for i in range(t):
	n = int(input())
	for j in range(n):
		s = input()
		for c in s:
			if c in lettermap.keys():
				lettermap[c] += 1
			else:
				lettermap[c] = 1
	flag = 0
	for pair in lettermap:
		if lettermap[pair] % n != 0:
			flag = 1
	if flag == 0:
		output.append('YES')
	else:
		output.append('NO')
	lettermap = {}
for iter in output:
	print(iter)


t = int(input())
for i in range(0, t):
	m = int(input())
	l = []
	for j in range(0, 26):
		l.append(0)
	for j in range(0, m):
		str1 = input()
		y = len(str1)
		for k in range(0, y):
			x = ord(str1[k])
			x = x - 97
			l[x] += 1
	ct = 0
	for j in range(0, 26):
		if l[j] % m != 0:
			ct += 1
			print('NO')
			break
	if ct == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = ''
	flag = True
	for z in range(n):
		s += input()
	for i in set(s):
		if s.count(i) % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
while t:
	n = int(input())
	k = n
	d = defaultdict(int)
	while n:
		s = input()
		for x in s:
			d[x] += 1
		n -= 1
	flag = 0
	for x in d:
		if d[x] % k != 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')
	t -= 1


from collections import defaultdict
for t in range(int(input())):
	de = defaultdict(int)
	n = int(input())
	for _ in range(n):
		for ch in input().strip():
			de[ch] += 1
	print('YES' if all((v % n == 0 for v in de.values())) else 'NO')


for _ in ' ' * int(input()):
	n = int(input())
	s = ''
	u = 'YES'
	for i in range(n):
		s += input()
	s = sorted(s)
	st = list(set(s))
	for i in range(len(st)):
		if s.count(str(st[i])) % n:
			u = 'NO'
			break
	print(u)


t = int(input())
for i in range(t):
	c = {}
	n = int(input())
	for j in range(n):
		s = input()
		for x in s:
			if x in c:
				c[x] += 1
				if c[x] == n:
					del c[x]
			else:
				c[x] = 1
	if len(c) == 0 or n == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	r = []
	for j in range(n):
		r += list(input())
	r.sort()
	j = ''
	for k in range(0, len(r), n):
		j += r[k] * n
	print(['NO', 'YES'][j == ''.join(r)])


t = int(input())
for z in range(t):
	n = int(input())
	arr = []
	for i in range(26):
		arr.append(int(0))
	for j in range(n):
		s = input()
		for k in range(len(s)):
			arr[ord(s[k]) - 97] += 1
	pos = False
	for i in range(26):
		if arr[i] % n != 0:
			pos = True
			break
	if pos:
		print('NO')
		continue
	print('YES')


def inp_n():
	return int(input())

def inp_list():
	return list(map(int, input().split()))

def inp_mul_num():
	return map(int, input().split())

def is_odd(n):
	if n & 1:
		return True
	return False
from collections import defaultdict
for _ in range(inp_n()):
	n = inp_n()
	hmap = defaultdict(lambda : 0)
	for i in range(n):
		s = input()
		for el in s:
			hmap[el] += 1
	f = 0
	for (k, v) in hmap.items():
		if v % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	str_L = [0 for _ in range(26)]
	for _ in range(n):
		string = input()
		for i in range(len(string)):
			str_L[ord(string[i]) - 97] += 1
	check = False
	for x in str_L:
		if x % n != 0:
			check = True
	if check == True:
		print('NO')
	else:
		print('YES')


import sys
from functools import reduce
from collections import Counter
import time
import datetime
from math import sqrt, gcd

def ip():
	return int(sys.stdin.readline())

def sip():
	return sys.stdin.readline()

def mip():
	return map(int, sys.stdin.readline().split())

def mips():
	return map(str, sys.stdin.readline().split())

def lip():
	return list(map(int, sys.stdin.readline().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)

def check_prime(n):
	if n < 2:
		return False
	for i in range(2, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
t = ip()
while t:
	t -= 1
	n = ip()
	dick = {}
	for i in range(n):
		s = sip()
		for item in s:
			if item not in dick.keys():
				dick[item] = 1
			else:
				dick[item] += 1
	flag = 0
	for item in dick:
		if dick[item] % n != 0:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	c = [0 for i in range(26)]
	for j in range(n):
		s = input()
		for j in s:
			c[ord(j) - 97] += 1
	a = True
	for k in range(26):
		if c[k] % n != 0:
			a = False
			break
	if a:
		print('YES')
	else:
		print('NO')


t = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
for q in range(0, t):
	p = [0] * 26
	l = 0
	n = int(input())
	a = []
	for i in range(0, n):
		a.append(str(input()))
	for i in range(0, n):
		w = a[i]
		for y in range(0, len(w)):
			for b in range(0, 26):
				if w[y] == s[b]:
					p[b] += 1
	for i in range(0, 26):
		if p[i] % n == 0 and (p[i] >= n or p[i] == 0):
			l += 1
	if l == 26:
		print('YES')
	else:
		print('NO')


t = int(input())
result_t = []
for testcases in range(t):
	str_dict = {}
	num_of_str = int(input())
	for n in range(num_of_str):
		string = input()
		for char in string:
			if char in str_dict:
				str_dict[char] += 1
			else:
				str_dict[char] = 1
	for key in str_dict:
		if str_dict[key] % num_of_str == 0:
			result = 'YES'
		else:
			result = 'NO'
			break
	result_t.append(result)
for result in result_t:
	print(result)


for _ in range(int(input())):
	n = int(input())
	c = {}
	for i in range(n):
		s = input()
		for i in s:
			c[i] = c.get(i, 0) + 1
	res = True
	for value in c.values():
		if value % n != 0:
			res = False
			break
	if res:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	(b, b1) = ({}, [])
	for k in range(n):
		s = input()
		for i in s:
			if i in b:
				b[i] += 1
			else:
				b[i] = 1
	f = 0
	for i in b:
		if b[i] % n == 0:
			f = 1
		else:
			f = 0
			break
	if f == 1:
		print('YES')
	else:
		print('NO')


t = 1
t = int(input())
while t:
	t -= 1
	n = int(input())
	lettercount = {}
	for _ in range(n):
		s = input()
		for el in s:
			if el in lettercount:
				lettercount[el] += 1
			else:
				lettercount[el] = 1
	for val in lettercount.values():
		if val % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = []
	flag = 0
	for _ in range(n):
		arr = input()
		for i in arr:
			a.append(i)
	d = {}
	for i in a:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	for i in d:
		if d[i] % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	count = [0] * 26
	for i in range(n):
		for ch in input():
			count[ord(ch) - ord('a')] = (count[ord(ch) - ord('a')] + 1) % n
	flag = True
	for i in range(26):
		if count[i] != 0:
			flag = False
	print('YES' if flag else 'NO')


for _ in range(int(input())):
	n = int(input())
	c = {}
	for _ in range(n):
		s = input()
		for x in s:
			c[x] = c.get(x, 0) + 1
	for x in c.values():
		if x % n:
			print('NO')
			break
	else:
		print('YES')


cases = int(input())
for i in range(cases):
	stringcount = int(input())
	stringliste = []
	all_freq = {}
	b = 0
	totalgoodletters = 0
	for e in range(stringcount):
		stringliste.append(input())
		stringliste[-1] = stringliste[-1].casefold()
	for j in range(stringcount):
		for k in stringliste[j]:
			if k in all_freq:
				all_freq[k] += 1
			else:
				all_freq[k] = 1
	for u in all_freq:
		b += 1
	for a in all_freq:
		if all_freq[a] % stringcount == 0:
			totalgoodletters += 1
			if totalgoodletters == b:
				print('YES')
		else:
			print('NO')
			break


inp = int(input())
for _ in range(inp):
	x = int(input())
	l = []
	for _ in range(x):
		l = l + list(input())
	s = set(l)
	for z in s:
		if l.count(z) % x != 0:
			print('NO')
			break
	else:
		print('YES')


import collections
import math

def sort(key):
	return key[1]

def pack(key):
	return key[0]

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def solve(m, p):
	ar = {}
	for i in p:
		if i in ar:
			ar[i] += 1
		else:
			ar[i] = 1
	for i in ar:
		if ar[i] % m != 0:
			return 'NO'
	return 'YES'
k = int(input())
for i in range(k):
	m = int(input())
	p = ''
	for i in range(m):
		p += input()
	print(solve(m, p))


import sys
from collections import Counter
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	s = ''
	for _ in range(n):
		s += input()
	cn = Counter(s)
	ans = True
	for c in cn.values():
		if c % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	d = dict()
	for j in range(n):
		s = input()
		for i in s:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	flag = 0
	for i in d.keys():
		if d[i] % n != 0:
			flag = 1
			break
	if not flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	has = [0] * 27
	for i in range(n):
		s = input()
		for j in s:
			has[ord(j) - ord('a')] += 1
	ans = 'YES'
	for i in has:
		if i % n != 0:
			ans = 'NO'
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	no_of_charac = [0 for j in range(26)]
	for x in range(n):
		a = input()
		for y in a:
			no_of_charac[ord(y) - 97] += 1
	hk = True
	for s in no_of_charac:
		if s % n != 0:
			hk = False
			break
	if hk:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = ''
	f = 0
	for t in range(n):
		inp = input()
		s = s + inp
	se = set(s)
	l = []
	for j in se:
		l.append(s.count(j))
	m = min(l)
	for k in l:
		if k % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *
for __ in range(int(input())):
	n = int(input())
	a = [0] * 26
	for i in range(n):
		s = input()
		for j in s:
			a[ord(j) - 97] += 1
	ans = 'YES'
	for i in range(26):
		if a[i] % n != 0:
			ans = 'NO'
	print(ans)


t = int(input())
from collections import Counter
for __ in range(t):
	n = int(input())
	initial = Counter()
	for j in range(n):
		initial += Counter(input())
	for value in initial.values():
		if value % n != 0:
			print('NO')
			break
	else:
		print('YES')


I = input
exec(int(I()) * "n=int(I());s=''.join(I()for _ in[0]*n);print('YNEOS'[any(s.count(x)%n for x in s)::2]);")


t = int(input())
for _ in range(t):
	n = int(input())
	dic = {}
	for i in range(n):
		s = input()
		for j in s:
			if dic.get(j):
				dic[j] += 1
			else:
				dic[j] = 1
	ans = True
	for i in dic.values():
		if i % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


def function(a, N):
	for i in a:
		if a[i] % N != 0:
			return 0
	return 1
for _ in range(int(input())):
	N = int(input())
	dictionary = dict()
	for z in range(N):
		array = list(input())
		for i in array:
			if i in dictionary:
				dictionary[i] += 1
			else:
				dictionary[i] = 1
	if function(dictionary, N):
		print('YES')
	else:
		print('NO')


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
from collections import Counter
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	for _ in range(int(input())):
		n = int(input())
		s = ''
		for w in range(n):
			s1 = input()
			s = s + s1
		d = dict(Counter(s))
		flag = 0
		for (key, value) in d.items():
			if value % n != 0:
				flag = 1
				break
		if flag == 0:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for case in range(int(input())):
	N = int(input())
	string = ''
	for n in range(N):
		string = string + input()
	totalCharQty = len(string)
	if totalCharQty % N != 0:
		print('NO')
	else:
		dix = {}
		for char in string:
			if char in dix:
				dix[char] += 1
			else:
				dix[char] = 1
		if any([i % N != 0 for i in dix.values()]):
			print('NO')
		else:
			print('YES')


def calc(strs):
	letters = dict()
	for ch in 'abcdefghijklmnopqrstuvwxyz':
		letters[ch] = 0
	for s in strs:
		for ch in s:
			letters[ch] = letters[ch] + 1
	for ch in letters.keys():
		if letters[ch] % len(strs) > 0:
			return False
	return True

def get_ints():
	return [int(n) for n in input().split()]

def get_floats():
	return [float(n) for n in input().split()]

def seq2str(seq):
	return ' '.join((str(item) for item in seq))
zzz = get_ints()
assert len(zzz) == 1
t = zzz[0]
for i in range(t):
	zzz = get_ints()
	assert len(zzz) == 1
	n = zzz[0]
	strs = list()
	for j in range(n):
		strs.append(input())
	res = calc(strs)
	print('YES' if res else 'NO')


from collections import Counter

def fun(st, val):
	ct = Counter(st)
	for (i, j) in ct.items():
		if j % val != 0:
			print('NO')
			return
	print('YES')
T = int(input())
for i in range(T):
	val = int(input())
	st = ''
	for i in range(val):
		st += input()
	fun(st, val)


for t in range(int(input())):
	lis = []
	n = int(input())
	for _ in range(n):
		s = input()
		lis.append(s)
	st = ''.join(lis)
	f = 1
	for x in st[:]:
		ct = st.count(x)
		if ct % n == 0:
			continue
		else:
			f = 0
			break
	if f == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	d1 = {}
	flag = 0
	for i in range(n):
		s = input()
		for i in s:
			if i not in d1:
				d1[i] = 1
			else:
				d1[i] += 1
	for i in d1:
		if d1[i] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	a = int(input())
	d = {}
	for i in range(a):
		for x in input():
			if x in d:
				d[x] += 1
			else:
				d[x] = 1
	key = True
	for i in d:
		if d[i] % a != 0:
			key = False
	if key:
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	op = ''
	for _ in range(n):
		s = str(input())
		op += s
	x = Counter(op)
	flag = 0
	for i in x.values():
		if i % n == 0:
			continue
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


import collections
for _ in range(int(input())):
	n = int(input())
	c = collections.Counter()
	for _ in range(n):
		s = input()
		for x in s:
			c[x] += 1
	ans = 'YES'
	for x in c.values():
		if x % n != 0:
			ans = 'NO'
			break
	print(ans)


import io, os
from collections import deque
import bisect
RL = lambda : list(map(int, input().split(' ')))
T = int(input())
for _ in range(T):
	n = int(input())
	dic = [0] * 26
	for i in range(n):
		s = input()
		for j in range(len(s)):
			dic[ord(s[j]) - ord('a')] += 1
	flag = 1
	for i in range(26):
		if dic[i] % n == 0:
			continue
		else:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


def count_letters(string, keys, counter):
	for letter in string:
		if letter not in keys:
			keys.append(letter)
			counter[letter] = 1
		else:
			counter[letter] += 1
	return counter

def check(counter, n):
	for value in counter.values():
		if value % n != 0:
			return False
	return True
t = int(input())
for _ in range(t):
	keys = []
	counter = {}
	n = int(input())
	for _ in range(n):
		s = input()
		counter = count_letters(s, keys, counter)
	if check(counter, n):
		print('YES')
	else:
		print('NO')


ls = []
t = int(input())
for z in range(t):
	n = int(input())
	s = []
	for i in range(n):
		t = list(input())
		s = s + t
	b = list(set(s))
	active = True
	for i in range(len(b)):
		if s.count(b[i]) % n != 0:
			active = False
			break
	if active == True:
		ls.append('YES')
	else:
		ls.append('NO')
for i in ls:
	print(i)


def result():
	n = int(input())
	alplabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'v', 'u', 'w', 'x', 'y', 'z']
	str = ''
	count = []
	b = 0
	for i in range(n):
		str_1 = input()
		str = str + str_1
	for i in range(26):
		coun = str.count(alplabet[i])
		count.append(coun)
	for i in range(26):
		if count[i] % n == 0:
			a = 1
		else:
			b = 2
	if b == 2:
		print('NO')
	else:
		print('YES')
t = int(input())
while t > 0:
	t = t - 1
	result()


t = int(input())
while t:
	t -= 1
	n = int(input())
	S = []
	for i in range(0, n):
		S += input()
	cmap = {}
	for si in S:
		if cmap.get(si) is None:
			cmap[si] = 1
		else:
			cmap[si] += 1
	ans = True
	for count in cmap.values():
		if count % n:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


import sys
import math as m

def main():
	pass

def binary(n):
	return bin(n).replace('0b', ' ')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def sinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def ninp():
	return map(int, sys.stdin.readline().strip().split())

def linp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(a):
	print(a)
for _ in range(iinp()):
	n = iinp()
	freq = [0] * 26
	f = 0
	for i in range(n):
		s = input()
		for c in s:
			freq[ord(c) - 97] += 1
	for i in freq:
		if i % n == 0:
			pass
		else:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	dic = defaultdict(int)
	for char in s:
		dic[char] += 1
	flag = 0
	for num in dic.values():
		if num % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


T = int(input())
for t in range(T):
	N = int(input())
	counts = [0 for i in range(26)]
	for n in range(N):
		s = input()
		for c in s:
			counts[ord(c) - 97] += 1
	ans = True
	for i in range(26):
		if counts[i] % N != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	d = {}
	for i in range(n):
		s = input().strip()
		for c in s:
			d[c] = d.get(c, 0) + 1
	for i in d:
		if d[i] % n:
			print('NO')
			return
	print('YES')
t = int(input())
while t:
	solve()
	t -= 1


for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			d[j] = d.get(j, 0) + 1
	f = True
	for i in d:
		if d[i] % n != 0:
			print('NO')
			f = False
			break
	if f:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	l = [0] * 26
	for i in range(n):
		s = input()
		for j in range(len(s)):
			l[ord(s[j]) - ord('a')] += 1
	flag = 0
	for k in l:
		if k % n != 0:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


t = int(input())
from collections import Counter
for _ in range(t):
	s = ''
	n = int(input())
	for _ in range(n):
		s += input()
	cs = Counter(s)
	can = True
	for ss in cs:
		if cs[ss] % n:
			can = False
			print('NO')
			break
	if can:
		print('YES')


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		string = []
		for j in range(n):
			string += list(input())
		string_set = set(string)
		flag = True
		for z in list(string_set):
			if string.count(z) % n != 0:
				flag = False
				break
		if flag:
			print('YES')
		else:
			print('NO')
main()


test_cases = int(input())
for test_case in range(test_cases):
	n = int(input())
	strings = ''
	for z in range(n):
		s = input()
		strings += s
	strings = sorted(strings)
	strings.append(0)
	c = 1
	switch = 1
	for i in range(len(strings) - 1):
		if strings[i] == strings[i + 1]:
			c += 1
		elif c % n == 0:
			c = 1
		else:
			switch = 0
			break
	if switch == 0:
		print('NO')
	else:
		print('YES')


def equal(j):
	d = {}
	for k in j[1]:
		if k not in d:
			d[k] = 1
		else:
			d[k] += 1
	l2 = d.values()
	for p in d.values():
		if p % j[0] != 0:
			return 'NO'
	return 'YES'
t = int(input())
l = []
for i in range(t):
	l1 = []
	n = int(input())
	for j in range(n):
		s = input()
		l1.extend(list(s))
	l.append([n, l1])
for j in l:
	print(equal(j))


import math, bisect
from collections import Counter, defaultdict
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	d = defaultdict(int)
	for i in range(n):
		s = input()
		for i in s:
			d[i] += 1
	flag = 1
	for i in d.keys():
		if d[i] % n != 0:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


def checkStrs(strs, N):
	for s in strs:
		if strs[s] % N != 0:
			return 'NO'
	return 'YES'
T = int(input())
for t in range(T):
	N = int(input())
	strs = {}
	for n in range(N):
		s = input()
		for i in range(len(s)):
			c = s[i]
			if c in strs:
				strs[c] += 1
			else:
				strs[c] = 1
	print(checkStrs(strs, N))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	array = []
	for i in range(n):
		array.append(input())
	string = ''.join(array)
	count = Counter(string)
	result = True
	for (key, value) in count.items():
		if value % n != 0:
			result = False
			break
	if result:
		print('YES')
	else:
		print('NO')


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input = sys.stdin.readline
from random import randint
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(inin()):
	n = inin()
	d = dd(int)
	f = 0
	for i in range(n):
		s = sin().strip()
		for j in s:
			d[j] += 1
	for j in d.values():
		if j % n != 0:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	a = int(input())
	count_char = {}
	for j in range(a):
		b = input()
		for k in b:
			if k not in count_char:
				count_char[k] = 1
			else:
				count_char[k] += 1
	tmp = 0
	for j in count_char:
		if count_char[j] % a != 0:
			tmp = 1
			break
	if tmp == 0:
		print('YES')
	else:
		print('NO')


import sys
import string
import math
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache
from fractions import Fraction

def mi(s):
	return map(int, s.strip().split())

def lmi(s):
	return list(mi(s))

def tmi(s):
	return tuple(mi(s))

def mf(f, s):
	return map(f, s)

def lmf(f, s):
	return list(mf(f, s))

def js(lst):
	return ' '.join((str(d) for d in lst))

def jsns(lst):
	return ''.join((str(d) for d in lst))

def line():
	return sys.stdin.readline().strip()

def linesp():
	return line().split()

def iline():
	return int(line())

def mat(n):
	matr = []
	for _ in range(n):
		matr.append(linesp())
	return matr

def matns(n):
	mat = []
	for _ in range(n):
		mat.append([c for c in line()])
	return mat

def mati(n):
	mat = []
	for _ in range(n):
		mat.append(lmi(line()))
	return mat

def pmat(mat):
	for row in mat:
		print(js(row))

def solve():
	n = iline()
	count = defaultdict(int)
	for _ in range(n):
		for c in line():
			count[c] += 1
	for c in count:
		if count[c] % n != 0:
			print('NO')
			return
	print('YES')

def main():
	t = iline()
	for _ in range(t):
		solve()
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	D = {}
	for _ in range(n):
		s = input().rstrip()
		for chat in s:
			if chat not in D:
				D[chat] = 1
			else:
				D[chat] += 1
	ok = 1
	for key in D:
		if D[key] % n != 0:
			ok = 0
	if ok == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	letter = [0] * 26
	n = int(input())
	s = ['' for _ in range(n)]
	tot_len = 0
	for i in range(n):
		s[i] = input()
		tot_len += len(s[i])
		for ch in s[i]:
			letter[ord(ch) - ord('a')] += 1
	ok = True
	cur = 0
	for i in range(26):
		if letter[i] == 0:
			continue
		if letter[i] % n != 0:
			ok = False
			break
		cur += 1
	if ok:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	dic = defaultdict(lambda : 0)
	for i in range(n):
		s = input()
		s = list(s)
		for j in s:
			dic[j] += 1
	temp = 0
	for i in dic.values():
		if i % n == 0:
			continue
		else:
			temp = 1
	if temp == 0:
		print('YES')
	else:
		print('NO')


import math
import os
import random
import re
import sys
from collections import defaultdict, Counter, deque
import heapq
from functools import lru_cache
from itertools import accumulate, chain, combinations, permutations, groupby, zip_longest
from math import floor, ceil, sqrt
t = int(input())
c = Counter()
res = []
for _ in range(t):
	n = int(input())
	c = Counter()
	for _ in range(n):
		c += Counter(input())
	if any((v % n for v in c.values())):
		res += ('NO',)
	else:
		res += ('YES',)
for ans in res:
	print(ans)


def alph_to_num(s):
	return ord(s) - ord('a')

def solve():
	T = int(input())
	ans = ['YES'] * T
	for t in range(T):
		N = int(input())
		lis = [0] * 26
		for i in range(N):
			S = input()
			for s in S:
				lis[alph_to_num(s)] += 1
		for l in lis:
			if l % N != 0:
				ans[t] = 'NO'
	return ans
print(*solve(), sep='\n')


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	n = I()
	a = []
	d = defaultdict(int)
	for i in range(n):
		s = input().strip()
		for j in s:
			d[j] += 1
	flag = 1
	for i in d:
		if d[i] % n:
			flag = 0
	if flag:
		print('YES')
	else:
		print('NO')
for _ in range(I()):
	solve()


for t in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		s = str(input())
		l += list(s)
	g = set(l)
	c = 0
	for i in g:
		if l.count(i) % n == 0:
			c = 1
			continue
		else:
			c = 0
			print('NO')
			break
	if c != 0:
		print('YES')


t = int(input())
while t:
	n = int(input())
	pp = []
	for i in range(n):
		s = input()
		pp.append(s)
	p = ''
	for i in range(len(pp)):
		p += pp[i]
	d = {}
	for i in range(len(p)):
		if p[i] in d:
			d[p[i]] += 1
		else:
			d[p[i]] = 1
	f = 1
	for (key, value) in d.items():
		if value % n == 0:
			f = 1
		else:
			f = 0
			break
	if f == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		s = input()
		l.append(s)
	l = ''.join(l)
	c = Counter(l)
	d = dict(c)
	flag = 0
	for x in d:
		if d[x] % n != 0:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


from collections import defaultdict
t = int(input())
for _ in range(t):
	counter = defaultdict(lambda : 0)
	n = int(input())
	words = []
	for i in range(n):
		words.append(input())
	for i in words:
		for j in i:
			counter[j] += 1
	flag = 1
	for i in counter:
		if counter[i] != 0 and counter[i] % n == 0:
			continue
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	t = int(input())
	l = []
	ans = 0
	for i in range(t):
		s = list(input())
		l = l + s
	for i in range(len(l)):
		a = l[i]
		if l.count(a) % t != 0:
			print('NO')
			ans = 1
			break
	if ans == 0:
		print('YES')


import sys
import collections as cc
import random as rd
input = sys.stdin.readline
I = lambda : cc.deque(map(int, input().split()))
for tc in range(int(input())):
	(n,) = I()
	f = cc.defaultdict(int)
	for i in range(n):
		s = input()
		for j in s:
			f[j] += 1
	ans = 'YES'
	for i in f:
		if f[i] % n:
			ans = 'NO'
			break
	print(ans)


def run():
	output = []
	for i in range(int(input())):
		strings = []
		for j in range(int(input())):
			strings.append(input())
		output.append(solve(strings))
	print('\n'.join(output))

def solve(strings):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	alphabet_dict = {i: 0 for i in alphabet}
	for i in strings:
		for j in i:
			alphabet_dict[j] += 1
	for i in alphabet_dict:
		if alphabet_dict[i] % len(strings) != 0:
			return 'NO'
	return 'YES'
run()


t = int(input())
while t > 0:
	n = int(input())
	l = []
	d = {}
	flag = 0
	for i in range(n):
		s = input()
		l.append(s)
	for i in l:
		for j in i:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	for i in d.values():
		if i % n != 0:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


T = int(input())

def getMod(n, s):
	a = []
	b = []
	for el in s:
		if a.count(el) == 0:
			a.append(el)
			b.append(s.count(el) % n)
	return b

def solve(n, s):
	u = getMod(n, s)
	if u.count(0) < len(u):
		print('NO')
	else:
		print('YES')
for _ in range(0, T):
	s = []
	n = int(input())
	for i in range(0, n):
		s += input()
	solve(n, s)


n = int(input())
for _ in range(n):
	d = {}
	for i in range(97, 123):
		d[chr(i)] = 0
	q = int(input())
	for i in range(q):
		w = input()
		for j in w:
			d[j] += 1
	flag = 0
	for (i, x) in d.items():
		if x != 0:
			if x % q != 0:
				flag = 1
				print('NO')
				break
	if flag == 0:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	ss = ''
	for i in range(n):
		s = input()
		ss = ss + s
	all_freq = {}
	f = 0
	for i in ss:
		if i in all_freq:
			all_freq[i] += 1
		else:
			all_freq[i] = 1
	for (key, value) in all_freq.items():
		if value % n != 0:
			f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	d = {}
	for k in range(n):
		s = input()
		for j in s:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	flag = True
	for j in d:
		if d[j] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


def readInt():
	return int(input())

def readList():
	return list(map(int, input().split()))

def readMap():
	return map(int, input().split())
from collections import Counter

def solve(m, D):
	valid = True
	for val in D.values():
		if val % m != 0:
			valid = False
			break
	return 'YES' if valid else 'NO'
n = readInt()
for _ in range(n):
	m = readInt()
	D = Counter()
	for _ in range(m):
		s = input()
		for i in s:
			D[i] += 1
	print(solve(m, D))


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	for i in range(n):
		d = input()
		a.append(d)
	data = ''
	for i in a:
		data += i
	da = set(list(data))
	li = []
	for i in da:
		li.append(data.count(i))
	flag = 1
	for i in li:
		if i % n != 0:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


import sys
import collections
t = int(sys.stdin.readline().strip())
for _ in range(t):
	n = int(sys.stdin.readline().strip())
	counts = collections.defaultdict(int)
	for _ in range(n):
		for c in sys.stdin.readline().strip():
			counts[c] += 1
	works = True
	for num in counts.values():
		if num % n != 0:
			works = False
			break
	if works:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
for i in range(test_cases):
	no_of_words = int(input())
	all_alpha = ''.join([input() for i in range(no_of_words)])
	equal = True
	for i in set(all_alpha):
		if all_alpha.count(i) % no_of_words != 0:
			equal = False
			break
	if equal == True:
		print('YES')
	else:
		print('NO')


t = int(input())
a = 0
g = 0
no = 0
list1 = []
list2 = []
for i in range(t):
	n = int(input())
	for j in range(n):
		s = input()
		for k in s:
			list1.append(k)
	for m in list1:
		if list1.count(m) % n != 0:
			g += 1
	if g > 0:
		print('NO')
	else:
		print('YES')
	g = 0
	list1.clear()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	strings = []
	for i in range(0, n):
		line = input()
		strings.append(line)
	cmap = [0] * 27
	for string in strings:
		for i in range(0, len(string)):
			cmap[ord(string[i]) - 97] += 1
	good = True
	for i in range(0, 27):
		if cmap[i] % n != 0:
			good = False
			break
	if n == 1:
		good = True
	if good:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	my_dict = dict()
	for i in range(n):
		s = input()
		for i in s:
			if i in my_dict:
				my_dict[i] += 1
			else:
				my_dict[i] = 1
		f = 1
		for i in my_dict:
			if my_dict[i] % n != 0:
				f = 0
				break
	if f:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	dct = defaultdict(lambda : 0)
	n = int(input())
	for _ in range(n):
		for c in input().rstrip():
			dct[c] += 1
	poss = 'YES'
	for (k, v) in dct.items():
		if v % n:
			poss = 'NO'
			break
	print(poss)


for _ in range(int(input())):
	n = int(input())
	a = ''
	for i in range(n):
		a += input()
	ans = 'YES'
	for i in list(set(a)):
		if a.count(i) % n != 0:
			ans = 'NO'
			break
	print(ans)


from itertools import permutations
from collections import defaultdict
from math import *
import os
import sys
from io import BytesIO, IOBase
from heapq import nlargest
from bisect import *
import copy
import itertools
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
t = int(input())
while t:
	t -= 1
	n = int(input())
	d = defaultdict(int)
	for _ in range(n):
		s = input()
		for i in range(len(s)):
			d[s[i]] += 1
	ispossible = True
	x = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	for i in range(26):
		if d[x[i]] % n != 0:
			ispossible = False
			break
	if ispossible == True:
		print('YES')
	else:
		print('NO')


import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))

def main():
	for _ in range(int(input())):
		n = int(input())
		c = Counter()
		for i in range(n):
			c += Counter(input().strip())
		f = 1
		for i in c:
			if c[i] % n != 0:
				f = 0
				break
		print('YNEOS'[f == 0::2])
main()


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = ''
	flag = True
	for strings in range(n):
		s += input()
	string = dict(Counter(s))
	for key in string:
		if string[key] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	t = t - 1
	n = int(input())
	lst = []
	dic = {}
	c = 0
	for i in range(n):
		s = input()
		lst.append(s)
	for i in lst:
		for j in i:
			if j in dic:
				dic[j] += 1
			else:
				dic[j] = 1
	for value in dic.values():
		if value % n == 0:
			c += 1
		else:
			continue
	if c == len(dic):
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	x = ''
	for i in range(n):
		s = input()
		x += s
	d = Counter(x)
	test = 0
	for i in d:
		if d[i] % n != 0:
			test = 1
	if test:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	norm = True
	abc = sorted(''.join([input() for _ in range(n)]))
	for i in abc:
		if abc.count(i) % n != 0:
			norm = False
			break
	if norm:
		print('YES')
	else:
		print('NO')


n = int(input())

def helper(m):
	arr = [0] * 26
	for i in range(m):
		my_str = input()
		for tmp in my_str:
			arr[ord(tmp) - 97] += 1
	for i in range(26):
		if arr[i] % m != 0:
			return 'NO'
	return 'YES'
for _ in range(n):
	m = int(input())
	print(helper(m))


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math
from collections import defaultdict
for _ in range(ri()):
	n = ri()
	d = defaultdict(int)
	for __ in range(n):
		for i in rs():
			d[i] += 1
	for i in d.values():
		if i % n != 0:
			ws('NO')
			break
	else:
		ws('YES')


for _ in range(int(input())):
	n = int(input())
	dic = {}
	for i in range(n):
		s = input()
		for j in s:
			dic[j] = dic.get(j, 0) + 1
	poss = True
	for (i, j) in dic.items():
		if j % n != 0:
			poss = False
			break
	if poss:
		print('YES')
	else:
		print('NO')


t = lambda : range(int(input()))
for _ in t():
	n = int(input())
	f = [0] * 26
	for _ in range(n):
		a = input()
		for j in a:
			f[ord(j) - 97] += 1
	for i in f:
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


def check_equal():
	n = int(input())
	strings = []
	flag = False
	for j in range(n):
		strings.extend(input())
	for ele in set(strings):
		count = strings.count(ele)
		if count % n != 0:
			flag = True
	if flag:
		return 'NO'
	else:
		return 'YES'
no_of_test_cases = int(input())
for i in range(no_of_test_cases):
	res = check_equal()
	print(res)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	for _ in range(n):
		s = input()
		for x in s:
			arr.append(x)
	c = Counter(arr)
	if all([x % n == 0 for x in list(c.values())]):
		print('YES')
	else:
		print('NO')


tCases = int(input())
for _ in range(tCases):
	n = int(input())
	freqDict = {}
	flag = 0
	for i in range(n):
		temp = input()
		for j in range(len(temp)):
			if temp[j] in freqDict:
				freqDict[temp[j]] += 1
			else:
				freqDict.update({temp[j]: 1})
	for (key, value) in freqDict.items():
		if value % n != 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop, heapify
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import lru_cache
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	cnt = Counter()
	for j in range(n):
		cnt += Counter(st())
	ans = 1
	for i in cnt:
		if cnt[i] % n:
			ans = 0
	print('YES' if ans else 'NO')


import sys, math, cmath, time
start_time = time.time()

def solve():
	n = inp()
	q = ''
	for i in range(n):
		s = insr()
		q = q + s
	w = string_counter(q)
	qw = 0
	for i in range(len(w)):
		if w[i] % n != 0:
			qw = 1
			break
	if qw == 0:
		print('YES')
	else:
		print('NO')

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b

def factorial(n, m=1000000007):
	q = 1
	for i in range(n):
		q = q * (i + 1) % m
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


from collections import Counter
for j in range(int(input())):
	a = int(input())
	b = ''
	for j in range(a):
		c = input()
		b = b + c
	b = Counter(b)
	for (i, j) in b.items():
		if j % a != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = ''
	for _ in range(n):
		s += str(input().strip())
	d = {}
	for ch in s:
		if ch in d:
			d[ch] += 1
		else:
			d[ch] = 1
	flag = 0
	for item in d:
		if d[item] % n != 0:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	f = 0
	mydict = dict()
	for c in range(n):
		a = input()
		for j in a:
			mydict[j] = mydict.get(j, 0) + 1
	for i in mydict:
		if mydict[i] % n != 0:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


tc = int(input())
import string
a = string.ascii_lowercase
for _ in range(tc):
	n = int(input())
	alpha = [0] * 26
	total = 0
	for i in range(n):
		c = input()
		total += len(c)
		for ca in c:
			alpha[ord(ca) - 97] += 1
	good = True
	for i in range(26):
		if alpha[i] % n != 0:
			good = False
	if good and total % n == 0:
		print('YES')
	else:
		print('NO')


import sys
from collections import defaultdict
read = lambda : sys.stdin.readline().strip()
for _ in range(int(read())):
	n = int(read())
	d = defaultdict(int)
	for _ in range(n):
		for i in read():
			d[i] += 1
	for val in d.values():
		if val % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = [0] * 26
	for i in range(n):
		x = input()
		for j in x:
			a[ord(j) - ord('a')] += 1
	flag = True
	for i in range(26):
		if a[i] % n != 0:
			flag = False
			break
	if not flag:
		print('NO')
	else:
		print('YES')


import os
import heapq
import sys, threading
import math
import operator
from collections import defaultdict, deque
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)
threading.stack_size(2 ** 27)

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		d = defaultdict(int)
		for i in range(n):
			s = input()
			for j in s:
				d[j] += 1
		ok = True
		for i in d.keys():
			if d[i] % n != 0:
				ok = False
				break
		if ok:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import defaultdict
for i in range(int(input())):
	n = int(input())
	x = defaultdict(lambda : 0)
	for j in range(n):
		a = input()
		for p in a:
			x[p] += 1
	q = True
	for p in x:
		if x[p] % n != 0:
			q = False
	if q:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	t = ''
	for i in range(n):
		s = str(input())
		t = t + s
	set_t = list(set(t))
	N = len(set_t)
	k = 1
	for i in range(N):
		c = t.count(set_t[i])
		if c % n != 0:
			k = 0
			break
	if k == 0:
		print('NO')
	else:
		print('YES')


def helper(strings, n):
	hashmap = {}
	for string in strings:
		for ch in string:
			if ch in hashmap:
				hashmap[ch] += 1
			else:
				hashmap[ch] = 1
	for val in hashmap.values():
		if val % n != 0:
			print('NO')
			return
	print('YES')

def main():
	t = int(input())
	while t > 0:
		n = int(input())
		N = n
		strings = []
		while n > 0:
			strings.append(input())
			n -= 1
		helper(strings, N)
		t -= 1
main()


t = int(input())
for i in range(t):
	n = int(input())
	s = ''
	f = 0
	for i in range(n):
		x = input()
		s = s + x
	setter = set(s)
	for ch in setter:
		if s.count(ch) % n != 0:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')
	f = 0
	s = ''


for _ in range(int(input())):
	n = int(input())
	a = [0] * 26
	for i in range(n):
		s = input()
		for j in s:
			a[ord(j) - ord('a')] += 1
	if all((i % n == 0 for i in a)):
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	freq = [0] * 26
	for i in range(n):
		s = input().strip()
		for j in range(len(s)):
			freq[ord(s[j]) - ord('a')] += 1
	ans = True
	for i in range(26):
		if freq[i] % n != 0:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	freq = {}
	for i in range(n):
		s = input()
		for j in s:
			if j in freq:
				freq[j] += 1
			else:
				freq[j] = 1
	flag = True
	for (k, v) in freq.items():
		if v % n != 0:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


import sys
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(buff_readline())

def read_int_n():
	return list(map(int, buff_readline().split()))

def read_float():
	return float(buff_readline())

def read_float_n():
	return list(map(float, buff_readline().split()))

def read_str():
	return readline().strip()

def read_str_n():
	return readline().strip().split()

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap
from collections import Counter

@mt
def slv(N, S):
	c = Counter()
	for s in S:
		c += Counter(s)
	return 'YES' if all(map(lambda k: c[k] % N == 0, c.keys())) else 'NO'

def main():
	for _ in range(read_int()):
		N = read_int()
		S = [read_str() for _ in range(N)]
		print(slv(N, S))
main()


import sys
from math import ceil, gcd, log2, log10
from collections import defaultdict
from queue import deque

def get_array_int():
	li = list(map(int, input().split()))
	return li

def get_int():
	return int(input())

def solve():
	n = get_int()
	hash = defaultdict(int)
	l = n
	while n:
		s = input()
		for c in s:
			hash[c] += 1
		n -= 1
	ans = None
	for (k, v) in hash.items():
		if v % l != 0:
			ans = 'NO'
			break
	if not ans:
		print('YES')
	else:
		print('NO')
t = int(input())
while t:
	solve()
	t -= 1


for _ in range(int(input())):
	n = int(input())
	S = []
	for _ in range(n):
		s = input()
		S.append(s)
	table = {}
	for w in S:
		for c in w:
			if c in table.keys():
				table[c] += 1
			else:
				table[c] = 1
	f = 1
	for i in table.keys():
		if table[i] % n != 0:
			f = 0
			break
	if f == 1:
		print('YES')
	else:
		print('NO')


def isPossible():
	n = int(input())
	arr = []
	for i in range(n):
		arr.append(input())
	ans = [0] * 26
	for i in range(n):
		for j in arr[i]:
			ans[ord(j) - 99] += 1
	for i in ans:
		if i % n != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(isPossible())


t = int(input())
for test in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	letters = list(set(s))
	res = True
	for i in range(len(letters)):
		if s.count(letters[i]) % n != 0:
			res = False
	if res:
		print('YES')
	else:
		print('NO')


import sys
I = lambda : int(input())
RL = readline = lambda : sys.stdin.readline().strip('\n')
RM = readmap = lambda x=int: map(x, readline().split(' '))
for _ in range(I()):
	n = I()
	hist = [0] * 26
	oa = ord('a')
	for k in range(n):
		for i in RL():
			hist[ord(i) - oa] += 1
	print(['NO', 'YES'][all([hist[i] % n == 0 for i in range(26)])])


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 1000010
MOD = 10 ** 9 + 7
spf = [i for i in range(MAXN)]
spf[0] = -1

def sieve():
	for i in range(2, MAXN, 2):
		spf[i] = 2
	for i in range(3, int(MAXN ** 0.5) + 1):
		if spf[i] == i:
			for j in range(i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def fib(n, m):
	if n == 0:
		return [0, 1]
	else:
		(a, b) = fib(n // 2)
		c = a % m * (b % m * 2 - a % m) % m
		d = a % m * (a % m) % m + b % m * b % m % m
		if n % 2 == 0:
			return [c, d]
		else:
			return [d, c + d]

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()
for _ in range(int(input())):
	n = int(input())
	x = defaultdict(int)
	for i in range(n):
		s = input()
		for j in s:
			x[j] += 1
	for i in x.keys():
		if x[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


for k in range(int(input())):
	n = int(input())
	s = ''
	answer = 'YES'
	for i in range(n):
		s += input()
	for i in set(s):
		if s.count(i) % n != 0:
			answer = 'NO'
	print(answer)


for _ in range(int(input())):
	n = int(input())
	l1 = []
	for i in range(n):
		l1.extend(list(input()))
	l2 = list(set(l1))
	for i in l2:
		if l1.count(i) % n != 0:
			print('NO')
			break
	else:
		print('YES')


import collections
t = int(input())
for i in range(t):
	n = int(input())
	res = []
	d = collections.Counter()
	for i in range(n):
		s = input()
		res.append(s)
		d += collections.Counter(s)
	if n == 1:
		print('YES')
		continue
	for (k, v) in d.items():
		if v % n:
			print('NO')
			break
	else:
		print('YES')


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	ans = [0] * 26
	for i in range(n):
		s = input()
		for j in s:
			ans[ord(j) - 97] += 1
	an = 'YES'
	for i in ans:
		if i % n != 0:
			an = 'NO'
	print(an)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	d = defaultdict(int)
	for i in range(n):
		s = input()
		for let in s:
			d[let] += 1
	for key in d:
		if d[key] % n != 0:
			print('NO')
			break
	else:
		print('YES')


from sys import stdin, stdout
import math
from itertools import permutations, combinations, permutations
from collections import defaultdict
from collections import Counter
from bisect import bisect_left
import sys
from queue import PriorityQueue
import operator as op
from functools import reduce
mod = 1000000007

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())

def printIn(ob):
	return stdout.write(str(ob) + '\n')

def powerLL(n, p):
	result = 1
	while p:
		if p & 1:
			result = result * n % mod
		p = int(p / 2)
		n = n * n % mod
	return result

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def myCode():
	n = I()
	d = defaultdict(int)
	for i in range(n):
		for j in input():
			d[j] += 1
	for i in d:
		if d[i] % n != 0:
			print('NO')
			return
	print('YES')

def main():
	for t in range(I()):
		myCode()
main()


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 5
T = 1
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	d = {}
	num = n
	while n > 0:
		s = str(stdin.readline().strip('\n'))
		for i in s:
			if i not in d:
				d[i] = 0
			d[i] += 1
		n -= 1
	ok = True
	for i in d:
		if d[i] % num != 0:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


ct = input()
for _ in range(int(ct)):
	n = input()
	arr = []
	fail = 0
	for _ in range(int(n)):
		arr.append(input())
	full = ''.join(arr)
	for i in ''.join(set(full)):
		if full.count(i) % int(n) != 0:
			fail = 1
			break
	if fail == 0:
		print('YES')
	else:
		print('NO')


alpha = list('abcdefghijklmnopqrstuvwxyz')
alphadic = {}
for i in range(26):
	alphadic[alpha[i]] = i
t = int(input())
for _ in range(t):
	n = int(input())
	checker = [0 for i in range(26)]
	for i in range(n):
		strs = str(input())
		for j in strs:
			checker[alphadic[j]] += 1
	flag = True
	for c in range(26):
		if checker[c] % n != 0:
			flag = False
	if flag == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	dict1 = dict()
	for _ in range(n):
		s = input()
		for i in s:
			if i in dict1:
				dict1[i] += 1
			else:
				dict1[i] = 1
	found = 0
	for key in dict1:
		if dict1[key] % n != 0:
			found = 1
			break
	if found == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	s = ''
	n = 0
	m = int(input())
	for j in range(m):
		kk = str(input())
		s += kk
	for k in range(len(s)):
		counter = s.count(s[k])
		if counter >= m and counter % m == 0:
			n = n + 1
		else:
			break
	if n == len(s):
		print('YES')
	else:
		print('NO')


from collections import Counter
t = int(input())
for i in range(t):
	flag_yes = True
	n = int(input())
	c = Counter()
	for j in range(n):
		s = input()
		for ch in s:
			c[ch] += 1
	for ch in c.values():
		if ch % n != 0:
			flag_yes = False
			break
	if flag_yes:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = list()
	d = [0 for i in range(26)]
	for i in range(n):
		s.append(input())
		for j in s[-1]:
			d[ord(j) - 97] += 1
	flag = True
	for i in range(26):
		if d[i] % n == 0:
			continue
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	strings = [input() for _ in range(n)]
	d = defaultdict(int)
	for s in strings:
		for c in s:
			d[c] += 1
	flag = 0
	for c in d:
		if d[c] % n is not 0:
			flag = 1
			break
	res = 'YES' if flag == 0 else 'NO'
	print(res)


for _ in range(int(input())):
	N = int(input())
	a = []
	for i in range(N):
		a.append(input())
	d = {}
	for i in a:
		for x in i:
			if x not in d:
				d[x] = 1
			else:
				d[x] += 1
	flag = True
	for (k, v) in d.items():
		if v % N != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
alphabet = 'abcdefghijklmnopqrstuvwxyx'
for _ in range(t):
	cnt = 0
	a = []
	for i in range(26):
		a.append(0)
	res = 'YES'
	n = int(input())
	for i in range(n):
		s = input()
		cnt += len(s)
		for x in s:
			a[alphabet.find(x)] += 1
	if cnt % n is not 0:
		res = 'NO'
	for j in range(26):
		if a[j] % n is not 0:
			res = 'NO'
	print(res)


from sys import stdin
from collections import Counter
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	s = [input() for x in range(n)]
	a = Counter()
	for x in s:
		a.update(x)
	valid = True
	for x in a:
		if a[x] % n != 0:
			valid = False
			break
	print('YES' if valid else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	dic = {}
	for j in range(n):
		st = input()
		for p in st:
			try:
				dic[p] += 1
			except:
				dic[p] = 1
	flag = 0
	for k in dic:
		if dic[k] % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	x = []
	for i in range(n):
		a = list(input())
		x.extend(a)
	p = sorted(list(set(x)))
	a = [x.count(i) % n for i in p]
	if sum(a) == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter
from sys import stdin, stdout

def II():
	return int(stdin.readline())

def SI():
	return stdin.readline()[:-1]
yes = 'YES\n'
no = 'NO\n'

def solveTC():
	n = II()
	s = ''
	for _ in range(n):
		s += SI()
	cs = Counter(s)
	ans = yes
	for k in cs.keys():
		if cs[k] % n != 0:
			ans = no
			break
	stdout.write(ans)
t = II()
for _ in range(t):
	solveTC()


from collections import defaultdict
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	d = defaultdict(lambda : 0)
	for i in range(n):
		s = input()
		s = list(s)
		for i in range(len(s)):
			d[s[i]] += 1
	q = 1
	for val in d.values():
		if val % n != 0:
			q = 0
			break
	if q == 0:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	d = {}
	for j in range(n):
		s = input()
		for c in s:
			if d.__contains__(c):
				d[c] += 1
			else:
				d[c] = 1
	yes = True
	for j in d:
		if d[j] % n != 0:
			yes = False
			break
	print('YES' if yes else 'NO')


t_case = int(input())
for _ in range(t_case):
	n = int(input())
	l = []
	for __ in range(n):
		l.append(input())
	m = dict()
	for i in l:
		for j in i:
			if j in m.keys():
				m[j] += 1
			else:
				m[j] = 1
	for i in m.values():
		if i % n:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	have = [0] * 26
	for i in range(n):
		d = list(input())
		for g in range(len(d)):
			have[ord(d[g]) - 97] += 1
	fl = True
	for i in range(26):
		if have[i] % n != 0:
			fl = False
	if fl:
		print('YES')
	else:
		print('NO')


def solve(n, s):
	for i in range(len(s)):
		if not s.count(s[i]) % n == 0:
			return 'NO'
	return 'YES'
t = int(input())
for t in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	result = solve(n, s)
	print(result)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s = s + input()
	count = Counter(s)
	count = count.values()
	flag = 0
	for i in count:
		if i % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


from collections import deque
from collections import OrderedDict
import math
import sys
import os
import threading
import bisect
import operator
import heapq
from atexit import register
from io import BytesIO
import io
from sys import stdin, stdout
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	dis = dict()
	for i in range(n):
		temLis = input()
		for j in range(len(temLis)):
			if temLis[j] in dis:
				dis[temLis[j]] += 1
			else:
				dis[temLis[j]] = 1
	Answer = 'YES'
	for i in dis:
		if dis[i] % n != 0:
			Answer = 'NO'
	print(Answer)
sys.exit(0)

class Person:

	def __init__(self, name, age):
		self.name = name
		self.age = age
p1 = Person('heelo', 27)
print(help(Person))
age = 26
name = 'Swaroop'
print('Возрас {} -- {} лет'.format(name, age))
print(help(object))


from collections import Counter as C
import sys
input = sys.stdin.readline
for T in range(int(input())):
	N = int(input())
	S = eval('input().strip()+' * N + 'str()')
	S = C(S)
	F = 1
	for v in S.values():
		if v % N:
			F = 0
			break
	print(['NO', 'YES'][F])


for i in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	u = set(s)
	flag = 0
	for i in u:
		if s.count(i) % n != 0:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = [0 for i in range(26)]
	for i in range(n):
		s = input()
		for c in s:
			l[ord(c) - 97] += 1
	f = 0
	for i in l:
		if i % n != 0:
			print('NO')
			f = 1
			break
	if not f:
		print('YES')


from sys import stdin, stdout
from collections import Counter

def find(S, N):
	c = Counter()
	for i in S:
		c.update(i)
	for i in c:
		if c[i] % N:
			return 'NO'
	return 'YES'

def main():
	for _ in range(int(stdin.readline())):
		N = int(stdin.readline())
		arr = []
		for i in range(N):
			arr.append(stdin.readline().strip())
		print(find(arr, N))
main()


from pprint import pprint
alfabet = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for j in range(t):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for k in s:
			if k not in alfabet:
				raise Exception(f'"{k}" is not lowercase latin letter')
			if k in d:
				d[k] += 1
			else:
				d[k] = 1
	q = True
	for k in d:
		if d[k] % n != 0:
			q = False
			break
	if q:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	s1 = str()
	arr = list()
	for i in range(n):
		s = input()
		s1 = s1 + s
	arr = list(map(str, s1))
	val = dict()
	for alph in arr:
		val[alph] = val.get(alph, 0) + 1
	arr1 = list()
	for (k, v) in val.items():
		arr1.append(v)
	count = 0
	for x in arr1:
		if x % n == 0:
			count = count + 1
	if count == len(arr1):
		print('YES')
	else:
		print('NO')
	t = t - 1


for _ in range(int(input())):
	arr = []
	arr1 = []
	arr2 = []
	n = int(input())
	for t in range(n):
		z = input()
		arr.append(z)
	final_string = ''.join(arr)
	for k in set(final_string):
		if final_string.count(k) % n == 0:
			arr2.append('t')
			pass
		else:
			arr2 = []
			print('NO')
			break
	if arr2 != []:
		print('YES')


from sys import stdin, stdout

def gmi():
	return map(int, stdin.readline().strip().split())

def gms():
	return map(str, stdin.readline().strip().split())

def gari():
	return list(map(int, stdin.readline().strip().split()))

def gars():
	return list(map(int, stdin.readline().strip().split()))

def gs():
	return stdin.readline().strip()

def gls():
	return list(stdin.readline())

def gi():
	return int(stdin.readline())
mod = 1000000007
test = gi()
while test:
	ans = 0
	test -= 1
	n = gi()
	s = ''
	N = n
	while n:
		n -= 1
		s += gs()
	st = set(s)
	n = N
	flag = True
	for i in st:
		if s.count(i) % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


from collections import Counter
test = int(input())
while test > 0:
	test -= 1
	number = int(input())
	temp = number
	list1 = []
	flag = 0
	while number > 0:
		number -= 1
		str1 = input()
		list1.append(str1)
	newstr = ''
	for i in list1:
		newstr += i
	dict1 = Counter(newstr)
	for i in dict1:
		if dict1[i] % temp != 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


def cnt_al(cnt_arr, s):
	for i in s:
		cnt_arr[ord(i) - ord('a')] += 1

def check(cnt_arr, n):
	for i in cnt_arr:
		if i % n != 0:
			return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	cnt_arr = [0] * 26
	for i in range(n):
		s = input()
		cnt_al(cnt_arr, s)
	if check(cnt_arr, n):
		print('YES')
	else:
		print('NO')


def count_char(s, d1):
	for x in s:
		if x not in d1:
			d1[x] = 1
		else:
			d1[x] += 1
t = int(input())
while t:
	poss = 1
	t -= 1
	s = []
	d1 = {}
	n = int(input())
	for i in range(n):
		temp = input()
		count_char(temp, d1)
	for x in d1:
		if d1[x] % n != 0:
			poss = 0
	if poss:
		print('YES')
	else:
		print('NO')


from collections import Counter
k = int(input())
for i in range(k):
	n = int(input())
	isTrue = True
	data = Counter()
	for i in range(n):
		x = input()
		data += Counter(x)
	isTrue = True
	for i in data:
		if data[i] % n:
			isTrue = False
			break
	if isTrue:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	li = [0] * 26
	for i in range(n):
		x = input()
		for i in x:
			li[ord(i) - ord('a')] += 1
	flag = 0
	for i in range(26):
		if li[i] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


tests = int(input())
for t in range(tests):
	n = int(input())
	dic = {}
	for _ in range(n):
		ls = input()
		for item in ls:
			if item in dic:
				dic[item] += 1
			else:
				dic[item] = 1
		check = True
	for key in dic:
		if dic[key] % n != 0:
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


import collections
for _ in range(int(input())):
	n = int(input())
	l = []
	for __ in range(n):
		s = input()
		l.append(s)
	d = collections.defaultdict()
	for i in l:
		for j in i:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	x = 0
	for (i, j) in d.items():
		if j % n != 0:
			x = 1
			break
	if x:
		print('NO')
	else:
		print('YES')


for I in range(int(input())):
	n = int(input())
	letters = {}
	for i in range(n):
		s = input()
		for char in s:
			if char not in letters:
				letters[char] = 1
			else:
				letters[char] += 1
	result = 'YES'
	for letter in letters:
		if letters[letter] % n != 0:
			result = 'NO'
	print(result)


from collections import Counter
numberoftestcase = int(input())
for j in range(numberoftestcase):
	n = int(input())
	k = ''
	for i in range(n):
		k += input()
	k = Counter(list(k))
	ans = ''
	for (a, b) in k.items():
		if b % n != 0:
			ans = 'NO'
			break
		else:
			ans = 'YES'
	print(ans)


a = int(input())
rus = 'abcdefghijklmnopqrstuvwxyz'
for i in range(a):
	b = int(input())
	mm = ''
	l = True
	for j in range(b):
		s = str(input())
		mm += s
	for n in rus:
		if mm.count(n) % b != 0:
			l = False
			break
	if l == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	subs = set(s)
	for j in subs:
		if s.count(j) % n != 0:
			print('NO')
			break
	else:
		print('YES')


n = int(input())
for t in range(n):
	y = int(input())
	x = [0] * 26
	for i in range(y):
		a = input()
		c = [0] * len(a)
		c = list(a)
		c.sort()
		for j in range(len(c)):
			if j == 0:
				b = c.count(c[j])
				x[ord(c[j]) - 97] += b
			if j > 0 and c[j] != c[j - 1]:
				b = c.count(c[j])
				x[ord(c[j]) - 97] += b
	z = 0
	for i in range(len(x)):
		if x[i] % y != 0:
			z = 1
			break
	if z == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	a = [0] * 26
	for j in range(n):
		s = input()
		for k in range(len(s)):
			a[ord(s[k]) - ord('a')] += 1
	d = True
	for k in range(26):
		if a[k] % n != 0:
			print('NO')
			d = False
			break
	if d == True:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	count = [0 for _ in range(26)]
	for _ in range(n):
		for c in input():
			count[ord(c) - ord('a')] += 1
	if all((x % n == 0 for x in count)):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	data = dict()
	for j in range(n):
		s = list(input())
		for k in s:
			if k in data:
				data[k] += 1
			else:
				data[k] = 1
	for j in data:
		if data[j] % n != 0:
			print('NO')
			break
	else:
		print('YES')


import sys
import math
from functools import reduce
import bisect

def getN():
	return int(input())

def getNM():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def input():
	return sys.stdin.readline().rstrip()

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return False
for _ in range(int(input())):
	n = getN()
	s = ''
	for _ in range(n):
		s += input()
	for i in s:
		if s.count(i) % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	t = []
	for i in range(n):
		s = input().strip()
		x = list(s)
		t.extend(x)
	m = set(t)
	count = 0
	for letter in m:
		if t.count(letter) % n == 0:
			count += 1
		else:
			print('NO')
			break
	if count == len(m):
		print('YES')


from collections import defaultdict as dd
import sys
input = sys.stdin.readline
t = int(input())
while t:
	d = dd(int)
	n = int(input())
	lol = 0
	for i in range(n):
		s = input().split()[0]
		for j in s:
			d[j] += 1
	for i in d:
		if d[i] % n != 0:
			lol = 1
			break
	if lol:
		print('NO')
	else:
		print('YES')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	l = [0] * 26
	for i in range(n):
		s = input()
		for i in range(len(s)):
			l[ord(s[i]) - 97] += 1
	flag = 0
	for i in range(len(l)):
		if l[i] != 0 and l[i] % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter

def tc():
	n = int(input())
	a = [input() for _ in range(n)]
	if sum((len(s) for s in a)) % n:
		print('NO')
		return
	c = Counter(''.join(a))
	for cnt in c.values():
		if cnt % n:
			print('NO')
			return
	print('YES')
T = int(input())
for _ in range(T):
	tc()


t = int(input())
for _ in range(0, t):
	n = int(input())
	a = ''
	for i in range(0, n):
		s = input()
		a = a + s
	b = list(set(a))
	flag = 0
	for i in b:
		if a.count(i) % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


def solve():
	n = int(input())
	mp = dict()
	for i in range(0, 26):
		mp[chr(ord('a') + i)] = 0
	for i in range(n):
		s = input()
		for ch in s:
			mp[ch] = mp[ch] + 1
	for (key, value) in mp.items():
		if value and value % n != 0:
			print('NO')
			return
	print('YES')
t = int(input())
for _ in range(t):
	solve()


def add_dict(s, d):
	for i in s:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	return d
t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	for _ in range(n):
		d = add_dict(input(), d)
	f = True
	for i in d.values():
		if i % n != 0:
			f = False
			print('NO')
			break
	if f:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	counts = dict()
	for i in range(n):
		str = input()
		for i in str:
			counts[i] = counts.get(i, 0) + 1
	for x in counts:
		if counts[x] % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	counter = Counter()
	n = int(input())
	for s in range(n):
		counter.update(input())
	for i in counter.values():
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


import collections
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = n
	d = collections.defaultdict(int)
	while n:
		n -= 1
		stri = input()
		for i in stri:
			d[i] += 1
	done = True
	for i in d.keys():
		if d[i] % a != 0:
			done = False
			break
	print('YES' if done else 'NO')


import sys

def find_freq_table(N, src_word):
	table = {}
	flag = 0
	for letter in src_word:
		if letter in table:
			table[letter] += 1
		else:
			table[letter] = 1
	for item in table:
		if table[item] % N != 0:
			flag = 1
			break
	if flag == 0:
		return 'YES'
	else:
		return 'NO'
n = int(sys.stdin.readline().strip())
for i in range(n):
	src = ''
	N = int(sys.stdin.readline().strip())
	for j in range(N):
		src_str = str(sys.stdin.readline().strip())
		src = src + src_str
	print(find_freq_table(N, src))


import sys
sysinput = sys.stdin.readline
import time
start_time = time.time()

def inp():
	return int(sysinput())

def inlt():
	return list(map(int, sysinput().split()))

def insr():
	s = sysinput()
	return list(s[:len(s) - 1])

def invr():
	return map(int, sysinput().split())
t = inp()
while t > 0:
	t -= 1
	n = inp()
	lst = []
	for i in range(n):
		s = input()
		lst.extend(list(s))
	st = set(lst)
	ans = 'YES'
	num = []
	for char in st:
		num = lst.count(char)
		if num % n != 0:
			ans = 'NO'
			break
	print(ans)


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = mpos(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum
from math import *
for _ in range(int(input())):
	n = int(input())
	di = dict()
	for i in range(n):
		st = input()
		for i in st:
			di.setdefault(i, 0)
			di[i] += 1
	f = 1
	for v in di.values():
		if v % n:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	d = {}
	for j in range(n):
		s = list(input())
		for k in s:
			d.setdefault(k, 0)
			d[k] += 1
	f = 0
	for k in d.keys():
		if d[k] % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	ll = [0] * 26
	n = int(input())
	bool = True
	for _ in range(n):
		s = input()
		pp = set(s)
		for c in pp:
			cc = s.count(c)
			ll[ord(c) - 97] += cc
	for x in ll:
		if x % n != 0:
			bool = False
	if bool == True:
		print('YES')
	else:
		print('NO')


t = int(input(''))
sol = []
num = []
for k in range(t):
	arr = []
	num = int(input(''))
	s = 0
	cnt = [0] * 27
	for i in range(num):
		s = input('')
		for j in range(len(s)):
			cnt[ord(s[j]) - 97] += 1
	flag = 0
	for i in range(len(cnt)):
		if cnt[i] != 0:
			if cnt[i] % num != 0:
				flag = 1
				break
	if flag:
		sol.append('NO')
	else:
		sol.append('YES')
for i in range(t):
	print(sol[i])


from sys import stdin, stdout

class Solve:

	def solve(self):
		R = stdin.readline
		W = stdout.write
		for i in range(int(input())):
			letters = [0 for j in range(26)]
			n = int(input())
			for j in range(n):
				s = input()
				for c in s:
					letters[ord(c) - ord('a')] += 1
			flg = 1
			for letter in letters:
				if letter % n:
					print('NO')
					flg = 0
					break
			if flg:
				print('YES')

def main():
	s = Solve()
	s.solve()
main()


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for _ in range(n):
		l.append(input())
	d = dict()
	for char in ''.join(l):
		if char in d:
			d[char] += 1
		else:
			d[char] = 1
	b = 1
	for char in d:
		if d[char] % n != 0:
			print('NO')
			b = 0
			break
	if b:
		print('YES')


import sys
input = sys.stdin.readline
from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	lis = []
	c = Counter(dict())
	for _ in range(n):
		a = input().strip()
		c.update(a)
	g = 0
	for i in c:
		if c[i] % n:
			g = 1
			break
	if g:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	lst = [0] * 26
	n = int(input())
	for i in range(n):
		st = input()
		for char in st:
			lst[ord(char) - 97] += 1
	if all((s % n == 0 for s in lst)):
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	q = int(input())
	a = list()
	for i in range(q):
		a.append(input())
	ans = dict()
	for i in a:
		for j in i:
			ans[j] = ans.get(j, 0) + 1
	for i in ans:
		if ans[i] % q != 0:
			print('NO')
			break
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	lis = []
	for i in range(n):
		s = input()
		lis.extend(list(s))
	flag = 0
	for i in range(len(lis)):
		if lis.count(lis[i]) % n == 0:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


mod = 10 ** 9 + 7

def func():
	n = int(input())
	arr = [0 for i in range(26)]
	for i in range(n):
		s = input()
		for j in s:
			arr[ord(j) - 97] += 1
	for i in range(26):
		if arr[i] % n != 0:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	func()


import collections

def solve(A, n):
	cnt = collections.defaultdict(int)
	total = 0
	for string in A:
		for c in string:
			cnt[c] += 1
		total += len(string)
	for (k, v) in cnt.items():
		if v % n != 0:
			return False
	return True
res = []
t = int(input())
while t:
	n = int(input())
	k = n
	strings = []
	while k:
		strings.append(input())
		k -= 1
	if solve(strings, n):
		res.append('YES')
	else:
		res.append('NO')
	t -= 1
for r in res:
	print(r)


for _ in range(int(input())):
	n = int(input())
	lib = {}
	for _ in range(n):
		ar = list(input())
		for ele in ar:
			if ele in lib:
				lib[ele] += 1
			else:
				lib[ele] = 1
	flag = 0
	for ele in lib:
		if lib[ele] % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter
for t in range(int(input())):
	n = int(input())
	res = 'YES'
	s = ''
	for i in range(n):
		s = s + input().strip()
	l = [x for x in s]
	d = Counter(l)
	for i in d:
		if d[i] % n != 0:
			res = 'NO'
			break
	print(res)


t = int(input().split()[0])
for case in range(t):
	n = int(input().split()[0])
	letters = [0] * 30
	for i in range(n):
		s = input().split()[0]
		for c in s:
			letters[ord(c) - 96] += 1
	flag = True
	for i in range(1, 27):
		if letters[i] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for kj in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s = s + input()
	s1 = set(s)
	f = 1
	for i in s1:
		if s.count(i) % n != 0:
			f = 0
	if f == 0:
		print('NO')
	else:
		print('YES')


from collections import defaultdict
for _ in range(int(input())):
	N = int(input())
	MyDict = defaultdict(int)
	for i in range(N):
		Temp = input()
		for j in Temp:
			MyDict[j] += 1
	Check = True
	for i in MyDict:
		if MyDict[i] % N != 0:
			Check = False
			break
	if Check:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = ''
	count = 1
	run = True
	ans = []
	for i in range(n):
		s = input()
		a += s
	for i in sorted(a):
		if a.count(i) % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	hash1 = [0] * 26
	for i in range(n):
		s = input()
		for j in s:
			hash1[ord(j) - 97] += 1
	check = True
	for x in hash1:
		if x % n != 0:
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


repeat = int(input())
for i in range(repeat):
	ans = int(input())
	books = {}
	answer = 0
	for k in range(ans):
		strochka = input()
		for bookv in strochka:
			if bookv in books:
				books[bookv] += 1
			else:
				books[bookv] = 1
	for k in books:
		if books[k] % ans == 0:
			answer += 1
	if answer == len(books):
		print('YES')
	else:
		print('NO')


from collections import Counter
l = []
for _ in range(int(input())):
	n = int(input())
	s = []
	for i in range(n):
		s = s + list(input())
	d = dict(Counter(s))
	flg = 1
	for i in d.values():
		if i % n != 0:
			flg = 0
			break
	if flg == 1:
		l.append('YES')
	else:
		l.append('NO')
for i in l:
	print(i)


for i in range(int(input())):
	n = int(input())
	sl = [0] * 30
	for j in range(n):
		for k in input():
			sl[ord(k) - 97] += 1
	f = True
	for i in sl:
		if i % n:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


testcase = int(input())
for i in range(testcase):
	n = int(input())
	l = []
	c = dict()
	flag = 0
	for k in range(n):
		s = input()
		l.append(s)
	for string in l:
		for char in string:
			if char in c:
				val = int(c[char]) + 1
				c[char] = val
			else:
				c[char] = 1
	for (key, values) in c.items():
		if int(c[key]) % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


from collections import defaultdict, Counter
t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	for _ in range(n):
		s += input()
	c = Counter(s)
	for (k, v) in c.items():
		if v % n:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for k in range(t):
	n = int(input())
	l = [0 for i in range(26)]
	for j in range(n):
		s1 = list(str(input()))
		for i in range(len(s1)):
			l[ord(s1[i]) % ord('a')] += 1
	temp = True
	for i in range(26):
		if l[i] % n != 0:
			temp = False
			break
	if temp == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = ''
	for _ in range(n):
		s1 = input()
		s = s + s1
	d = {}
	c = 0
	for i in s:
		if i not in d:
			d[i] = 1
		else:
			d[i] = d[i] + 1
	for v in d.values():
		if v % n == 0:
			c = c + 1
	if c == len(d):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	s = ''
	n = int(input())
	for j in range(n):
		str = input()
		s = s + str
	l = []
	flag = 1
	for a in s:
		l.append(s.count(a))
	L = list(set(l))
	for i in L:
		if i % n != 0:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


T = int(input())
out = [str] * T
for i in range(T):
	N = int(input())
	A = [None] * N
	x = ''
	for j in range(N):
		x += str(input())
	out[i] = 'YES'
	for j in x:
		if x.count(j) % N != 0:
			out[i] = 'NO'
for i in out:
	print(i)


T = int(input())
for t in range(T):
	n = int(input())
	strings = list()
	for i in range(n):
		strings.append(input())
	counts = [0 for _ in range(26)]
	for string in strings:
		for s in string:
			counts[ord(s) - ord('a')] += 1
	no = False
	for i in range(26):
		if counts[i] % n != 0:
			no = True
	if no:
		print('NO')
	else:
		print('YES')


import sys
import math
from collections import Counter

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		ss = input()
		s += ss
	c = Counter(s)
	a = []
	for (i, j) in c.items():
		a.append(j)
	flag = 0
	for i in a:
		if i % n == 0:
			continue
		else:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	strs = []
	dum = n
	while n > 0:
		n -= 1
		s = str(input())
		strs += [s]
	dic = {}
	for i in strs:
		for j in i:
			if j not in dic:
				dic[j] = 1
			else:
				dic[j] = int(dic[j]) + 1
	tru = False
	for k in dic:
		if int(dic[k]) % dum == 0:
			continue
		else:
			tru = True
			break
	if tru == True:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	t -= 1
	a = [0 for x in range(26)]
	n = int(input())
	for i in range(n):
		s = input()
		for e in s:
			a[ord(e) - ord('a')] += 1
	gg = False
	for e in a:
		if e % n != 0:
			gg = True
			break
	if gg:
		print('NO')
	else:
		print('YES')


import sys, math, heapq, copy
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right
from functools import cmp_to_key
t = int(input())
for _ in range(t):
	n = int(input())
	alpha = [0 for i in range(26)]
	for i in range(n):
		s = input()
		for j in s:
			alpha[ord(j) - ord('a')] += 1
	flag = 0
	for i in range(26):
		if alpha[i] % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().rstrip()
t = int(input())
for _ in range(t):
	n = int(input())
	di = {}
	for _ in range(n):
		for c in input():
			if c not in di:
				di[c] = 0
			di[c] += 1
	for i in di.values():
		if i % n > 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	lst = []
	dct = dict()
	count = 0
	for i in range(n):
		st = input()
		for i in range(len(st)):
			dct[st[i]] = dct.get(st[i], 0) + 1
			count = count + 1
	if count % n != 0:
		print('NO')
	else:
		flag = 0
		for i in dct:
			if dct[i] % n == 0:
				flag = flag + 1
		if flag == len(dct):
			print('YES')
		else:
			print('NO')


import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

def solve(lst, nrows):
	console('----- solving ------')
	c = Counter()
	for strr in lst:
		c += Counter(strr)
	for v in c.values():
		if v % nrows:
			return 'NO'
	return 'YES'

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	return
for case_num in range(int(input())):
	nrows = int(input())
	grid = []
	for _ in range(nrows):
		grid.append(input())
	res = solve(grid, nrows)
	print(res)


for iii in range(int(input())):
	q = [0 for i in range(26)]
	n = int(input())
	for j in range(n):
		x = input()
		for i in x:
			q[122 - ord(i)] += 1
	flag = 0
	for i in q:
		if i % n == 0:
			pass
		else:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


from collections import Counter

def solution(strs):
	n = len(strs)
	c = Counter(''.join(strs))
	for item in c.most_common():
		if item[1] % n != 0:
			return 'NO'
	return 'YES'
cases = int(input())
for _ in range(cases):
	n = int(input())
	strs = []
	for _ in range(n):
		strs.append(input())
	print(solution(strs))


t = int(input())
for _ in range(t):
	n = int(input())
	d = {}
	for i in range(n):
		c = 1
		s = input()
		for j in s:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	for i in set(d.values()):
		if i % n == 0:
			continue
		else:
			c = 0
	if c:
		print('YES')
	else:
		print('NO')


from collections import Counter
answers = []
n = int(input())
for i in range(n):
	num_str = int(input())
	letters = []
	for k in range(num_str):
		st = input()
		letters += list(st)
	num_letters = len(letters)
	if num_letters % num_str != 0:
		answers.append('NO')
		continue
	stlen = num_letters / num_str
	counter = Counter(letters)
	f = False
	for value in counter.values():
		if value % num_str != 0:
			f = True
			break
	if f:
		answers.append('NO')
	else:
		answers.append('YES')
for ans in answers:
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	for j in range(n):
		arr.append(input())
	alpha = [0 for i in range(27)]
	for i in arr:
		for j in i:
			alpha[ord(j) - 97] += 1
	for i in alpha:
		if i % n != 0:
			flag = 1
			break
		else:
			flag = 0
	if flag == 0:
		print('YES')
	else:
		print('NO')


cases = int(input())
for i in range(cases):
	n = int(input())
	arr = []
	for j in range(n):
		s = input()
		arr.append(s)
	d = {}
	for string in arr:
		for c in string:
			if c in d:
				d[c] += 1
			else:
				d[c] = 1
	pos = True
	for k in d:
		v = d[k]
		if v % n != 0:
			pos = False
			break
	if pos:
		print('YES')
	else:
		print('NO')


from collections import Counter
n = int(input())
for i in range(n):
	m = int(input())
	x = [list(input()) for i in range(m)]
	y = [x[i][j] for i in range(m) for j in range(len(x[i]))]
	z = Counter(y)
	p = list(z.values())
	q = [i for i in range(len(p)) if p[i] % m == 0]
	if len(q) == len(p):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	b = []
	n = int(input())
	for i in range(n):
		b += list(input())
	d = {}
	for i in range(len(b)):
		if b[i] in d:
			d[b[i]] += 1
		else:
			d[b[i]] = 1
	for i in d:
		if d[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter

def equal(s, n):
	for i in s.values():
		if i % n:
			return False
	return True
for _ in range(int(input())):
	n = int(input())
	s = Counter()
	for _ in range(n):
		s.update(input())
	if equal(s, n):
		print('YES')
	else:
		print('NO')


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(300000)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	n = int(input())
	d = defaultdict(int)
	f = 0
	for i in range(n):
		s = input()
		for j in s:
			d[j] += 1
	for j in d:
		if d[j] % n != 0:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
from collections import Counter
for __ in range(itg()):
	counter = Counter()
	n = itg()
	for _ in range(n):
		counter += Counter(inp())
	ans = 'YES'
	for v in counter.values():
		if v % n != 0:
			ans = 'NO'
			break
	print(ans)


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	str = ''
	val = 0
	for i in range(n):
		s = input().strip()
		str = str + s
	d = dict(Counter(str))
	for i in d:
		if d[i] % n != 0:
			print('NO')
			val = 1
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	c = 0
	s = ''
	for _ in range(n):
		s += input()
	q = set(s)
	for j in q:
		if s.count(j) % n != 0:
			c += 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	alpha = [0 for i in range(30)]
	flag = True
	for i in range(n):
		nList = list(input().rstrip())
		for j in range(len(nList)):
			alpha[ord(nList[j]) - ord('a')] += 1
	for i in range(len(alpha)):
		if alpha[i] > 0 and alpha[i] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	x = 26 * [0]
	for i in range(n):
		for j in input():
			if j in 'abcdefghijklmnopqrstuvwxyz':
				x[ord(j) - ord('a')] += 1
	good = True
	for i in range(26):
		if x[i] % n != 0:
			good = False
			break
	print('YES' if good else 'NO')


def func(A):
	A_set = set(A)
	for i in A_set:
		if A.count(i) % N != 0:
			return 'NO'
	else:
		return 'YES'
for i in range(int(input())):
	N = int(input())
	A = []
	for i in range(N):
		A.extend(list(input()))
	print(func(A))


for i in range(int(input())):
	characters = {}
	n = int(input())
	for j in range(n):
		for char in input():
			if char in characters:
				characters[char] += 1
			else:
				characters[char] = 1
	good = True
	for val in characters.values():
		if val % n != 0:
			good = False
	if good:
		print('YES')
	else:
		print('NO')


def solve(n, s_arr):
	char_freq = {}
	for s in s_arr:
		for c in s:
			if c in char_freq:
				char_freq[c] += 1
			else:
				char_freq[c] = 1
	for f in char_freq.values():
		if f % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
results = list()
for _ in range(0, t):
	n = int(input())
	s_arr = list()
	for _ in range(0, n):
		s = input()
		s_arr.append(s)
	results.append(solve(n, s_arr))
for result in results:
	print(result)


count = int(input())
for j in range(count):
	x = int(input())
	s = {}
	for p in range(x):
		a = input()
		for i in range(len(a)):
			key = a[i]
			if key in s:
				s[key] += 1
			else:
				s[key] = 1
	y = 0
	v = 0
	for key in s:
		y += 1
	for key in s:
		v += 1
		if s[key] % x != 0:
			print('NO')
			break
		if v == y:
			print('YES')


t = int(input())
for i in range(0, t):
	n = int(input())
	l = []
	freq = [0] * 26
	f = 0
	ls = []
	for j in range(0, n):
		s = input()
		ls.append(s)
	for j in range(0, n):
		ss = ls[j]
		for k in range(0, len(ss)):
			ch = ss[k]
			freq[ord(ch) - 97] += 1
	for j in freq:
		if j % n != 0:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	alph = 'qwertyuiopasdfghjklzxcvbnm'
	alph = list(alph)
	alph.sort()
	m = int(input())
	sa = []
	alpha = [0] * 26
	for j in range(m):
		sa.append(input())
		for k in range(len(sa[j])):
			alpha[alph.index(sa[j][k])] += 1
	d = False
	for j in range(len(alpha)):
		if alpha[j] % m != 0:
			d = True
	if d:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	f = True
	for j in range(n):
		a.append(input())
	dic = {}
	for j in a:
		n1 = len(j)
		for k in range(n1):
			if j[k] in dic:
				dic[j[k]] += 1
			else:
				dic[j[k]] = 1
	for j in dic:
		if dic[j] % n != 0:
			f = False
	if f:
		print('YES')
	else:
		print('NO')


import sys
import math
input = sys.stdin.readline
from collections import deque
from queue import LifoQueue
for _ in range(int(input())):
	n = int(input())
	a = {}
	for i in range(n):
		s = input()
		pps = s[0]
		for j in s:
			if a.get(j, False):
				a[j] += 1
			else:
				a[j] = 1
	p = True
	pp = a[pps]
	for i in a:
		if a[i] % n != 0:
			print('NO')
			p = False
			break
	if p:
		print('YES')


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	n = sInt()
	ans = [0 for c in range(26)]
	for i in range(n):
		a = input()
		a = list(a)
		for j in range(len(a)):
			f = ord(a[j])
			ans[f - 97] += 1
	d = 0
	for i in range(26):
		if ans[i] % n != 0:
			d = 1
			break
	if d == 0:
		print('YES')
	else:
		print('NO')


import sys
ll = lambda : list(map(int, input().split()))
lls = lambda : list(map(str, input().split()))
fin = lambda : list(map(float, input().split()))
st = lambda : input()
v = lambda : map(int, input().split())
ii = lambda : int(input())
mod = 10 ** 9 + 7
from math import *
from datetime import datetime
from collections import *
import math
for _ in range(ii()):
	x = ii()
	s = ''
	for i in range(x):
		s += st()
	d = Counter(s)
	f = 1
	for i in d:
		if d[i] % x != 0:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	count = [0] * 26
	for _ in range(n):
		s = input()
		for char in s:
			pos = ord(char) - ord('a')
			count[pos] += 1
	ans = True
	for c in count:
		if c % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


import collections
for _ in range(int(input())):
	n = int(input())
	c = collections.Counter((c for _ in range(n) for c in input()))
	if all((count % n == 0 for count in c.values())):
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		m = dict()
		for j in range(n):
			s = input()
			for c in s:
				if c not in m:
					m[c] = 1
				else:
					m[c] += 1
		result = 'YES'
		for key in m:
			if m[key] % n != 0:
				result = 'NO'
				break
		print(result)
main()


from sys import stdin, stdout
from math import gcd, log2, log10, floor
import math
from collections import defaultdict
input = stdin.readline
for i in range(int(input())):
	n = int(input())
	dict = defaultdict(int)
	for j in range(n):
		a = input()
		for k in range(len(a)):
			dict[a[k]] += 1
	flag = 0
	for i in dict:
		if dict[i] % n != 0:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


from collections import *
for _ in range(int(input())):
	n = int(input())
	st = ''
	for i in range(n):
		st = st + input()
	c = Counter(st)
	f = 1
	c_val = list(c.values())
	for i in c_val:
		if i % n != 0:
			f = 0
			break
	if f == 1:
		print('YES')
	else:
		print('NO')


from collections import Counter

def check(n, s):
	big = ''
	for i in range(n):
		big += s[i]
	res = Counter(big)
	for each in res:
		if res[each] % n == 0:
			continue
		else:
			print('NO')
			return
	print('YES')
t = int(input())
n = []
s = []
for i in range(t):
	val1 = int(input())
	n.append(val1)
	val2 = []
	for j in range(val1):
		temp = str(input())
		val2.append(temp)
	s.append(val2)
for i in range(t):
	check(n[i], s[i])


from collections import Counter

def process():
	n = int(input())
	data = ''.join([input() for _ in range(n)])
	datadict = Counter(data)
	for x in datadict:
		if datadict[x] % n != 0:
			return 'NO'
	return 'YES'
for i in range(int(input())):
	print(process())


import sys
input = sys.stdin.readline
from bisect import bisect_left
from bisect import bisect_right
from math import ceil, factorial

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	n = int(input())
	dick = {}
	for __ in range(n):
		s = input().strip()
		for i in s:
			dick[i] = dick.get(i, 0) + 1
	f = 1
	for i in dick:
		if dick[i] % n != 0:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	res = {}
	flag = 0
	for i in range(n):
		s = input()
		for j in s:
			res[j] = res.get(j, 0) + 1
	for i in res:
		if res[i] % n != 0:
			flag += 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
strokes = []
for i in range(t):
	stroks = []
	n = int(input())
	stroks.append(str(n))
	for j in range(n):
		s = input()
		stroks.append(s)
	strokes.append(stroks)
answers = []
for stroks in strokes:
	letters = []
	letters_num = []
	for s in stroks:
		if s.isdigit() == False:
			for letter in s:
				if letter not in letters:
					letters.append(letter)
			letters_num += [0 for i in range(len(letters))]
			for letter in s:
				if letter in letters:
					letters_num[letters.index(letter)] += 1
	ans = []
	for p in range(len(letters)):
		if letters_num[p] % int(stroks[0]) == 0:
			ans.append(True)
		else:
			ans.append(False)
	answers.append(ans)
for ans in answers:
	if all(ans) == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	string = ''
	count = int(input())
	check_list = [0] * 26
	for __ in range(count):
		string += input()
	for ___ in range(len(string)):
		check_list[ord(string[___]) - ord('a')] += 1
	Y = 1
	for num in range(26):
		if check_list[num] % count != 0:
			Y = 0
			break
	if Y == 1:
		print('YES')
	else:
		print('NO')


from sys import *
from collections import defaultdict
times = int(input())
for i in range(times):
	n = int(input())
	dic = defaultdict(int)
	for j in range(n):
		s = input().strip()
		for c in s:
			dic[c] += 1
	possible = True
	for val in dic.values():
		if val % n == 0:
			continue
		else:
			possible = False
			break
	print('YES' if possible else 'NO')


for _ in range(int(input())):
	letters = {}
	words = int(input())
	for i in range(words):
		word = input()
		for symbol in word:
			if symbol in letters:
				letters[symbol] += 1
			else:
				letters[symbol] = 1
	result = True
	for num in letters.values():
		if num % words != 0:
			result = False
	if result:
		print('YES')
	else:
		print('NO')


import sys
readline = sys.stdin.readline

def i1():
	return int(readline())

def s1():
	return readline().rstrip()

def sn(n):
	return [readline().rstrip() for i in range(n)]

def sm(n):
	return (readline().rstrip() for i in range(n))

def redir(s):
	global readline
	import os
	fn = sys.argv[0] + f'/../in-{s}.txt'
	readline = open(fn).readline if os.path.exists(fn) else readline
redir('a')
from collections import Counter
for _ in range(i1()):
	n = i1()
	cnt = Counter(''.join(sm(n)))
	for i in cnt.values():
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


def check(arr):
	for i in range(26):
		if arr[i] % n != 0:
			return False
	return True
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = [0 for _ in range(26)]
	for i in range(n):
		ss = input()
		for s in ss:
			arr[ord(s) - 97] += 1
	if check(arr):
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	str = [input() for _ in range(n)]
	c = Counter(''.join(str))
	print('YES' if all((i % n == 0 for i in c.values())) else 'NO')


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	c = Counter()
	for _ in range(n):
		s = input()
		c.update(s)
	flag = True
	for v in c.values():
		if v % n != 0:
			flag = False
			break
	print('YES' if flag else 'NO')


n = int(input())
for _ in range(n):
	num = int(input())
	char = {}
	for __ in range(num):
		x = input()
		for each_char in x:
			if each_char in char:
				char[each_char] += 1
			else:
				char[each_char] = 1
	equal = True
	for k in char.keys():
		if char[k] % num != 0:
			equal = False
			break
	print('YES' if equal else 'NO')


t = int(input())
li = []
for i in range(0, t):
	li1 = []
	a = int(input())
	li1.append(a)
	s1 = ''
	for j in range(0, a):
		s = input()
		s1 = s1 + s
	li1.append(s1)
	li.append(li1)
for i in li:
	a1 = i[0]
	li3 = []
	for j in i[1]:
		a2 = i[1].count(j)
		li3.append(a2 % a1)
	if li3.count(0) == len(li3):
		print('YES')
	else:
		print('NO')


from collections import Counter

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		strings = [input() for i in range(n)]
		output = 'YES' if can_make_equal(strings) else 'NO'
		print(output)

def can_make_equal(strings):
	strings_n = len(strings)
	chars_counter = Counter(''.join(strings))
	return all((char_quantity % strings_n == 0 for (char, char_quantity) in chars_counter.items()))
main()


for _ in range(int(input())):
	n = int(input())
	b = ''
	for i in range(n):
		a = input()
		b += a
	b = sorted(b)
	charnum = 1
	status = 0
	c = []
	for i in range(len(b) - 1):
		if b[i] == b[i + 1]:
			charnum += 1
		else:
			c.append(charnum)
			charnum = 1
		if i == len(b) - 2:
			c.append(charnum)
	for i in c:
		if i % n != 0:
			status = 1
	if status == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
l = []
for i in range(t):
	n = int(input())
	s = ''
	for j in range(n):
		s += input()
	d = {}
	for j in s:
		if j in d:
			d[j] += 1
		else:
			d[j] = 1
	ans = True
	for j in d:
		if d[j] % n == 0:
			pass
		else:
			ans = False
			break
	if ans == True:
		l.append('YES')
	else:
		l.append('NO')
for i in l:
	print(i)


try:
	for _ in range(int(input())):
		dictt = {}
		flag = 1
		n = int(input())
		for mm in range(n):
			s = list(input())
			for j in s:
				if j in dictt:
					dictt[j] += 1
				else:
					dictt[j] = 1
		for value in dictt.values():
			if value % n:
				print('NO')
				flag = 0
				break
		if flag:
			print('YES')
except:
	pass


def f(l, n):
	h = {}
	for s in l:
		for i in s:
			try:
				h[i] += 1
			except:
				h[i] = 1
	for i in h.keys():
		if h[i] % n != 0:
			return False
	return True
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = []
	for i in range(n):
		k = input()
		l.append(k)
	if f(l, n):
		print('YES')
	else:
		print('NO')


from collections import Counter

def solve(s, n):
	c = Counter(s)
	for v in c.values():
		if v % n != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	s = ''
	for _ in range(n):
		s += input()
	print(solve(s, n))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	cnt = dict()
	for i in range(n):
		s = input().strip('\n')
		for j in s:
			try:
				cnt[j] += 1
			except:
				cnt[j] = 1
	ans = True
	for i in cnt:
		if cnt[i] % n:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


alpha = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(int(input())):
	arr = list()
	f = [0] * 26
	for _ in range(int(input())):
		arr.append(input())
	n = len(arr)
	for i in arr:
		for j in range(len(alpha)):
			f[j] = f[j] + i.count(alpha[j])
	st = 0
	for i in f:
		if i % n != 0:
			st = 1
			break
	if st == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	f = {}
	for j in range(n):
		s = input()
		for i in range(len(s)):
			if s[i] in f:
				f[s[i]] += 1
			else:
				f[s[i]] = 1
	fl = 0
	for k in f.values():
		if k >= n and k % n == 0:
			fl = 1
		else:
			fl = 0
			break
	if fl == 1:
		print('YES')
	else:
		print('NO')


from collections import Counter

def main():
	for _ in range(int(input())):
		l = Counter()
		x = int(input())
		for _ in range(x):
			l.update(input())
		l = list(l.values())
		yes = True
		for i in range(len(l)):
			if l[i] % x == 0:
				continue
			else:
				yes = False
		if yes:
			print('YES')
		else:
			print('NO')
main()


for i in range(int(input())):
	n = int(input())
	d = {}
	for j in range(n):
		s = list(input())
		for j in s:
			if j not in d:
				d[j] = 0
			d[j] += 1
	flg = 0
	for j in d:
		if d[j] % n != 0:
			flg = 1
	if flg == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	n = int(input())
	s = []
	for i in range(n):
		x = input()
		s.append(x)
	alphabets = [0] * 26
	ok = True
	for i in range(n):
		x = s[i]
		for j in range(len(x)):
			alphabets[ord(x[j]) - 97] += 1
	for i in range(26):
		if alphabets[i] % n != 0:
			ok = False
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	flag = 0
	for p in range(n):
		s = s + input()
	li = list(s)
	if len(li) % n != 0:
		print('NO')
		continue
	li_s = list(set(li))
	li2 = [0 for i in range(len(li_s))]
	for i in range(len(li_s)):
		cnt = li.count(li_s[i])
		if cnt % n == 1 or cnt < n:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter
t = int(input())
while t:
	t -= 1
	n = int(input())
	s = []
	for i in range(n):
		s.extend(list(input()))
	a = Counter(s)
	flag = 0
	for i in a.keys():
		if a[i] % n != 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	a = int(input())
	s = ''
	c = [0] * 26
	f = 0
	for j in range(a):
		b = input()
		s = s + b
	for j in s:
		d = ord(j) - 97
		c[d] = c[d] + 1
	for j in range(26):
		if c[j] % a == 0:
			f = f + 1
	if f == 26:
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	(n, a) = (int(input()), '')
	for _ in range(n):
		a += input()
	a = dict(Counter(a))
	for v in a.values():
		if v % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	ar = dict()
	for j in range(n):
		s = input()
		for val in s:
			if val in ar:
				ar[val] += 1
			else:
				ar[val] = 1
	flag = 0
	for key in ar:
		if ar[key] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(s, n, d, c) = ('', int(input()), {}, True)
	for i in range(n):
		s += str(input())
	for i in s:
		d[i] = d[i] + 1 if i in d else 1
	for i in d.values():
		if i % n != 0:
			c = False
			break
	print('YES') if c else print('NO')


def fun(l, n):
	h = {}
	for j in l:
		for i in j:
			if i not in h:
				h[i] = 1
			else:
				h[i] += 1
	for (i, j) in h.items():
		if j % n != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(input())
	print(fun(l, n))


import sys
from collections import Counter

def main():
	tn = int(input())
	for ti in range(tn):
		n = int(input())
		C = Counter()
		for i in range(n):
			C.update(input().strip())
		ans = 'YES'
		for v in C.values():
			if v % n != 0:
				ans = 'NO'
		print(ans)
main()


from sys import stdin
input = lambda : stdin.readline().strip()
from collections import deque as d
l = len
for _ in range(int(input())):
	n = int(input())
	s = ''
	x = 0
	for i in range(n):
		a = input()
		s += a
		x += l(a)
	if x / n - x // n != 0:
		print('NO')
	else:
		c = list(s)
		b = set(c)
		ans = True
		for i in b:
			if c.count(i) % n != 0:
				ans = False
				break
		if ans:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	f = dict()
	for i in range(n):
		s = input()
		for i in s:
			try:
				f[i] += 1
			except:
				f[i] = 1
	for i in f:
		if f[i] % n:
			print('NO')
			break
	else:
		print('YES')


def check_valid(counter, n):
	for key in counter:
		if counter[key] % n != 0:
			return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	counter = {}
	for _ in range(n):
		s = input()
		for char in s:
			if char not in counter:
				counter[char] = 0
			counter[char] += 1
	print('YES' if check_valid(counter, n) else 'NO')


t = int(input())
i = 0
while i < t:
	n = int(input())
	j = 0
	k = []
	l = []
	while j < n:
		s = list(input())
		for d in s:
			k.append(d)
			if d not in l:
				l.append(d)
		j += 1
	f = 0
	for x in l:
		c = k.count(x) % n
		if c != 0:
			print('NO')
			break
		else:
			f += 1
	if f == len(l):
		print('YES')
	i += 1


T = int(input())
for t in range(T):
	N = int(input())
	mp = {}
	for n in range(N):
		inp = input()
		for i in inp:
			if i not in mp:
				mp[i] = 1
			else:
				mp[i] += 1
	flag = 'YES'
	for (k, v) in mp.items():
		if v % N != 0:
			flag = 'NO'
	print(flag)


t = int(input())
d = dict()
r = []
for _ in range(t):
	n = int(input())
	tcs = []
	for _ in range(n):
		tcs.append(input())
	for c in tcs:
		for l in c:
			if d.get(l) != None:
				d[l] += 1
			else:
				d[l] = 1
	valid = True
	for k in d:
		if d[k] % n != 0:
			valid = False
	r.append('YES' if valid else 'NO')
	d = dict()
for a in r:
	print(a)


t = int(input())
lst = []
for i in range(t):
	s = ''
	r = int(input())
	for m in range(r):
		s = s + input()
	s = list(s)
	s.sort()
	s = ''.join(s)
	s = s + ' '
	ex = s[0]
	ccount = 1
	ans = 'YES'
	for w in range(1, len(s)):
		if s[w] != ex:
			if ccount % r != 0:
				ans = 'NO'
				break
			else:
				ex = s[w]
				ccount = 1
		else:
			ccount = ccount + 1
	lst.append(ans)
for i in lst:
	print(i)


for _ in range(int(input())):
	length = int(input())
	lt = [0] * 26
	for i in range(length):
		s = input()
		for x in s:
			lt[ord(x) - 97] += 1
	ans = 1
	for x in range(26):
		if lt[x] % length != 0:
			ans = 0
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for testcase in range(t):
	n = int(input())
	l = []
	for wordnumber in range(n):
		word = input()
		l.append(word)
	d = {}
	for word in l:
		for i in range(len(word)):
			if word[i] in d.keys():
				d[word[i]] = d[word[i]] + 1
			else:
				d[word[i]] = 1
	flag = 0
	for k in d.keys():
		if d[k] % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	alpha_map = [0] * 26
	for _ in range(n):
		s = input()
		for i in range(len(s)):
			diff = ord(s[i]) - ord('a')
			alpha_map[diff] += 1
	can = True
	for i in range(26):
		if alpha_map[i] == 0:
			continue
		if alpha_map[i] % n != 0:
			can = False
	if can:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ar = []
	hsh = {}
	for i in range(n):
		ar.append(input())
	for i in ar:
		for j in i:
			if hsh.get(j) == None:
				hsh[j] = 1
			else:
				hsh[j] += 1
	flag = 0
	for i in hsh:
		if hsh.get(i) % n != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
ii = lambda : int(input())
si = lambda : input()
jn = lambda x, l: x.join(map(str, l))
sl = lambda : list(map(str, input().strip()))
mi = lambda : map(int, input().split())
mif = lambda : map(float, input().split())
lii = lambda : list(map(int, input().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
for _ in range(ii()):
	n = ii()
	s = []
	for i in range(n):
		s.append(si())
	hash = [0] * 26
	for ele in s:
		for char in ele:
			hash[ord(char) - 97] += 1
	temp = 0
	for ele in hash:
		if ele % n != 0:
			temp = 1
			break
	if temp == 0:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
for j in range(n):
	t = int(input())
	di = defaultdict(int)
	for k in range(t):
		s = input().strip()
		for i in s:
			di[i] += 1
	ans = sum([i % t for i in di.values()])
	if ans == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for i in range(n):
		a = input()
		l.append(a)
	d = {}
	for i in l:
		for j in i:
			d[j] = 0
	for i in l:
		for j in i:
			d[j] += 1
	f = 0
	for (k, v) in d.items():
		if v % n != 0:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')


T = int(input())
while T > 0:
	N = int(input())
	a = ''
	for i in range(N):
		a = a + input()
	A = list(map(str, a))
	alpha = 'a'
	flag = 0
	for i in range(26):
		if A.count(alpha) % N != 0:
			print('NO')
			flag = 1
			break
		alpha = chr(ord(alpha) + 1)
	if flag == 0:
		print('YES')
	T = T - 1


import copy
import math
for _ in range(int(input())):
	n = int(input())
	arr_of_let = []
	arr = []
	for i in range(n):
		str1 = list(str(input()))
		for j in range(len(str1)):
			if str1[j] not in arr_of_let:
				arr_of_let.append(str1[j])
				arr.append(1)
			else:
				t = arr_of_let.index(str1[j])
				arr[t] += 1
	b = True
	for i in range(len(arr)):
		if arr[i] % n != 0:
			b = False
			break
	if b:
		print('YES')
	else:
		print('NO')


def funk(lst, n):
	lst = ''.join(lst)
	lst = str(lst)
	for i in range(len(lst)):
		if lst.count(lst[i]) % n != 0:
			return 1
	return 0
t = int(input())
for i in range(t):
	n = int(input())
	ls = []
	for i in range(n):
		s = str(input())
		ls.append(s)
	if funk(ls, n) == 1:
		print('NO')
	else:
		print('YES')


test = int(input())
result = []
for t in range(test):
	n = int(input())
	whole = ''
	check = True
	for num in range(n):
		word = input()
		whole = whole + word
	for x in range(len(whole)):
		if whole.count(whole[x]) % n != 0:
			check = False
	if check == True:
		result.append('YES')
	else:
		result.append('NO')
for r in range(len(result)):
	print(result[r])


from collections import Counter

def check(s, n):
	for i in s:
		if s[i] % n != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	s = Counter()
	for i in range(n):
		s += Counter(input())
	print(check(s, n))


t = int(input())
while t:
	n = int(input())
	n1 = n
	S = ''
	while n:
		s = input()
		S += s
		n = n - 1
	S1 = list(S)
	S2 = list(set(S1))
	c = 0
	l1 = []
	for i in range(len(S2)):
		l1.append(S1.count(S2[i]))
	for i in range(len(l1)):
		if l1[i] % n1 == 0:
			c += 1
	if c == len(l1):
		print('YES')
	else:
		print('NO')
	t = t - 1


t = int(input())
for _ in range(t):
	n = int(input())
	p = ''
	for _ in range(n):
		s = input()
		p += s
	q = set(p)
	c = 0
	for i in q:
		x = p.count(i)
		if x % n == 0:
			c += 1
	if c == len(q):
		print('YES')
	else:
		print('NO')


testCase = int(input())
for i in range(testCase):
	can = True
	wordsGetsu = int(input())
	alphabet = []
	getsu = []
	for j in range(wordsGetsu):
		word = input()
		for k in word:
			if k not in alphabet:
				alphabet.append(k)
				getsu.append(1)
			else:
				getsu[alphabet.index(k)] += 1
	for j in getsu:
		if j % wordsGetsu != 0:
			print('NO')
			can = False
			break
	if can:
		print('YES')


from collections import Counter
tt = int(input())
for t in range(tt):
	n = int(input())
	c = Counter()
	for i in range(n):
		c += Counter(input())
	f = True
	for (k, v) in c.items():
		f = f and v % n == 0
	if f:
		print('YES')
	else:
		print('NO')


import sys, threading
sys.setrecursionlimit(10 ** 8)
threading.stack_size(10 ** 8)
from collections import defaultdict

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		counts = defaultdict(int)
		for _ in range(n):
			s = input()
			for c in s:
				counts[c] += 1
		print('YES' if all((val % n == 0 for val in counts.values())) else 'NO')
threading.Thread(target=main).start()


from collections import Counter

def solve():
	N = int(input())
	counter = Counter()
	for _ in range(N):
		s = input()
		for ch in s:
			counter[ch] += 1
	possible = all((count % N == 0 for (ch, count) in counter.items()))
	print('YES' if possible else 'NO')
T = int(input())
for _ in range(T):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	chars = []
	for j in range(n):
		temp = input()
		chars.extend(list(temp))
	total = list(set(chars))
	flag = 0
	for i in range(len(total)):
		c = chars.count(total[i])
		if c % n != 0:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		for j in input():
			d[j] = d.get(j, 0) + 1
	if any((j % n for j in d.values())):
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	m = int(input())
	e = ''
	flag = 0
	for j in range(m):
		s = str(input())
		e = e + s
	d = set(e)
	for j in d:
		if e.count(j) % m != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	d = {}
	for j in range(n):
		s = input()
		for k in s:
			d[k] = d.get(k, 0) + 1
	for l in d:
		if d[l] % n != 0:
			print('NO')
			break
	else:
		print('YES')


import sys
from collections import defaultdict
name = sys.stdin.read()
jobGrid = []
isJob = True
row = []
grid = name.split('\n')
grid = grid[:-1]
numberOfCases = int(grid[0])
allstring = ''
allchars = []
answer = 'YES'
startCount = 1
for i in range(1, numberOfCases + 1):
	allstring = ''
	allchars = []
	answer = 'YES'
	for j in grid[startCount + 1:startCount + int(grid[startCount]) + 1]:
		allstring += j
	for k in allstring:
		if allstring.count(k) % int(grid[startCount]) != 0:
			answer = 'NO'
	print(answer)
	startCount += int(grid[startCount]) + 1


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		n = int(input())
		dic = {}
		for i in range(n):
			currString = input()
			for char in currString:
				freq = dic.get(char, 0)
				dic[char] = freq + 1
		ans = 'YES'
		for ele in dic:
			if dic[ele] % n != 0:
				ans = 'NO'
				break
		yield ans
t = int(input())
ans = gift()
print(*ans, sep='\n')


n = int(input())
l = []
for i in range(0, n):
	m = int(input())
	p = []
	for j in range(0, m):
		a = input()
		p.append(a)
	l.append(p)
c = []
for i in range(0, n):
	b = ''
	for j in range(0, len(l[i])):
		b = b + l[i][j]
	c.append(b)
for i in range(0, n):
	v = []
	for j in range(0, len(c[i])):
		v.append(c[i][j])
	w = list(set(v))
	n = 0
	r1 = 0
	for k in range(0, len(w)):
		if v.count(w[k]) % len(l[i]) == 0:
			r2 = 1
		else:
			r1 = 1
	if r1 == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	n = int(I1())
	d = {}
	for i in range(n):
		s = I1().strip()
		for x in s:
			d[x] = d.get(x, 0) + 1
	l = list(d.values())
	s = sum(l)
	if s % n != 0:
		print('NO')
	else:
		f = 0
		for x in l:
			if x % n != 0:
				f = 1
				break
		if f == 1:
			print('NO')
		else:
			print('YES')


t = int(input())
while t:
	n = int(input())
	d = {}
	c = 0
	for i in range(n):
		a = str(input())
		for j in a:
			if j in d.keys():
				d[j] += 1
			else:
				d[j] = 1
	for v in d.values():
		ans = v
		break
	for v in d.values():
		if v % n != 0:
			break
		else:
			c += 1
	if c == len(d):
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list()
	s = list()
	p = list()
	for i in range(n):
		a = list(input())
		s = s + a
	i = 0
	p = s
	p.sort()
	while i < len(s):
		if p.count(s[i]) % n == 0:
			i = i + p.count(s[i])
		else:
			print('NO')
			break
	if i >= len(s):
		print('YES')


T = int(input())
for test_case in range(T):
	n = int(input())
	all_freq = [0] * 26
	for _ in range(n):
		s = input()
		for i in s:
			all_freq[ord(i) - 97] += 1
		ans = True
		for i in range(26):
			if all_freq[i] % n != 0:
				ans = False
				break
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = {}
	for i in range(n):
		s = list(input())
		for j in s:
			a[j] = a.setdefault(j, 0) + 1
	for j in a:
		if a[j] > n:
			if a[j] % n != 0:
				print('NO')
				break
		elif n % a[j] != 0 and a[j] != 1:
			print('NO')
			break
		elif a[j] == 1 and n != 1:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = []
	ans = ''
	for i in range(n):
		s = input()
		ans += s
	ans = list(ans)
	c = list(Counter(ans).most_common())
	pt = 'YES'
	for i in range(len(c)):
		if c[i][1] % n != 0:
			pt = 'NO'
			break
	print(pt)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = []
	dic = defaultdict(int)
	l = 0
	for i in range(n):
		s = input()
		l += len(s)
		a.append(s)
		for j in s:
			dic[j] += 1
	if l % n == 0:
		f = 0
		for i in dic.keys():
			if dic[i] % n == 0:
				continue
			else:
				f = 1
				break
		if f == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
from collections import deque
for _ in range(int(input())):
	n = int(input())
	d = {chr(i): 0 for i in range(97, 123)}
	for i in range(n):
		s = input()
		for j in s:
			d[j] += 1
	flag = 1
	for i in d:
		if d[i] % n != 0:
			flag = 0
	if flag:
		print('YES')
	else:
		print('NO')


try:
	t = int(input())
	for _ in range(t):
		n = int(input())
		L = []
		for i in range(n):
			L.append(input())
		counts = dict()
		for i in range(n):
			for x in L[i]:
				counts[x] = counts.get(x, 0) + 1
		flag = 1
		for (k, v) in counts.items():
			if v % n != 0:
				flag = 0
				break
		if flag == 1:
			print('YES')
		else:
			print('NO')
except:
	pass


import sys
import itertools
input = sys.stdin.readline
I = lambda : list(map(str, input().split()))
(n,) = I()
n = int(n)
while n:
	(m,) = I()
	m = int(m)
	di = {}
	for _ in range(m):
		(arr,) = I()
		for i in arr:
			if i not in di:
				di[i] = 0
			di[i] += 1
	flag = 0
	for i in list(di.values()):
		if i % m != 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')
	n -= 1


from collections import *
for _ in range(int(input())):
	n = int(input())
	x = Counter(input())
	for i in range(n - 1):
		x = x + Counter(input())
	f = 1
	for (i, j) in x.items():
		if j % n != 0:
			f = 0
			break
	if f == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(0, n):
	t = int(input())
	d = {}
	f = 1
	for j in range(0, t):
		s = input()
		for k in s:
			if k not in d:
				d[k] = 1
			else:
				d[k] += 1
	for (l, p) in d.items():
		if p % t == 0:
			continue
		else:
			f = 0
			break
	if f == 0:
		print('NO')
	elif f == 1:
		print('YES')


t = int(input())
for q in range(t):
	n = int(input())
	mp = dict()
	for i in range(n):
		s = input()
		for j in range(0, len(s)):
			if s[j] in mp:
				mp[s[j]] += 1
			else:
				mp[s[j]] = 1
	ok = True
	for i in mp:
		if mp[i] % n != 0:
			ok = False
	if ok:
		print('YES')
	else:
		print('NO')


import sys
import math

def scan(input_type='int'):
	return list(map(int, sys.stdin.readline().strip().split()))

def solution():
	for _ in range(int(input())):
		n = int(input())
		s = []
		for i in range(n):
			s.append(input())
		a = {}
		for i in s:
			for j in i:
				if j in a:
					a[j] += 1
				else:
					a[j] = 1
		c = 0
		for i in a:
			if a[i] % n != 0:
				c = 1
				break
		if c == 1:
			print('NO')
		else:
			print('YES')
solution()


t = int(input())
for _ in range(t):
	n = int(input())
	dct = {}
	ok = True
	for i in range(n):
		s = input()
		for ch in s:
			try:
				if dct[ch] > 0:
					dct[ch] += 1
			except KeyError:
				dct[ch] = 1
	for el in dct:
		if dct[el] % n != 0:
			print('NO')
			ok = False
			break
	if ok:
		print('YES')


n = int(input())

def canbedone(thing):
	chars = {}
	for string in thing:
		for char in string:
			if char in chars.keys():
				chars[char] += 1
			else:
				chars[char] = 1
	for q in chars.values():
		if q % len(thing) != 0:
			return False
	return True
for _ in range(n):
	m = int(input())
	strings = []
	for _ in range(m):
		strings.append(input())
	if canbedone(strings):
		print('YES')
	else:
		print('NO')


import math
import os
import random
import re
import string
from sys import *
from collections import *

def bs(arr, x, l, r):
	if l <= r:
		mid = (r + l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return bs(arr, x, l, mid - 1)
		else:
			return bs(arr, x, mid + 1, r)
	else:
		return -1

def solve():
	for _ in range(int(input())):
		n = int(input())
		s = ''
		for i in range(n):
			l = input()
			s = s + l
		if n == 1:
			print('YES')
			continue
		l = list(s)
		c = dict(Counter(l))
		f = 1
		for i in c:
			if c[i] % n != 0:
				f = 0
				break
		if f == 1:
			print('YES')
		else:
			print('NO')
solve()


def freq(ll):
	d = dict()
	for i in ll:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	return d
for _ in range(int(input())):
	n = int(input())
	l = []
	ll = []
	f = 0
	for i in range(n):
		l.append(list(input()))
	for i in range(n):
		ll += l[i]
	for i in freq(ll):
		if freq(ll)[i] % n != 0:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')


t = int(input())
for i in range(t):
	myList = []
	d = {}
	n = int(input())
	for z in range(n):
		s = list(input())
		for x in range(len(s)):
			if s[x] in d:
				d[s[x]] += 1
			elif s[x] not in d:
				d[s[x]] = 1
	myList = list(d.values())
	for y in range(len(myList)):
		if myList[y] % n != 0:
			print('NO')
			break
		elif y == len(myList) - 1:
			print('YES')


from collections import defaultdict
t = int(input())
while t:
	t = t - 1
	n = int(input())
	s = []
	for i in range(n):
		s.append(input())
	dic = defaultdict(int)
	for string in s:
		for char in string:
			dic[char] = dic[char] + 1
	state = 'YES'
	for key in dic:
		if dic[key] % n > 0:
			state = 'NO'
			break
	print(state)


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	n = int(input())
	d = defaultdict(int)
	for j in range(n):
		s = input()
		for k in s:
			d[k] += 1
	flag = 0
	for j in d:
		if d[j] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


from collections import defaultdict
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	cnt = defaultdict(int)
	for _ in range(n):
		s = input()
		for c in s:
			cnt[c] += 1
	for (k, v) in cnt.items():
		if v % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	sg = ''
	for i in range(n):
		temp = input().strip()
		sg += temp
	ctr = Counter(sg)
	flag = False
	for i in ctr.values():
		if i % n != 0:
			flag = True
	if flag:
		print('NO')
	else:
		print('YES')


from collections import deque, defaultdict
from heapq import heapify, heappop, heappush
it = lambda : list(map(int, input().strip().split()))

def solve():
	n = int(input())
	S = []
	for _ in range(n):
		S.append(input().strip())
	C = [0] * 26
	for s in S:
		for ch in s:
			C[ord(ch) - ord('a')] += 1
	ok = True
	for i in range(26):
		if C[i] % len(S) != 0:
			ok = False
	print('YES' if ok else 'NO')
T = int(input())
for _ in range(T):
	solve()


for _ in range(int(input())):
	n = int(input())
	l = []
	for _ in range(n):
		l.append(input())
	d = dict()
	for i in range(n):
		for j in l[i]:
			if j in d.keys():
				d[j] += 1
			else:
				d[j] = 1
	c = 0
	for i in d.values():
		if i % n == 0:
			c += 1
		else:
			break
	if c == len(d):
		print('YES')
	else:
		print('NO')


__n = int(input())
for __i in range(__n):
	_n = int(input())
	arr = []
	for _i in range(_n):
		_s = input()
		for s in _s:
			arr.append(s)
	arr.sort()
	_set = set(arr)
	flag = True
	for i in _set:
		if arr.count(i) % _n != 0:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	no_of_strings = int(input())
	count_letter = [0 for i in range(26)]
	for _ in range(no_of_strings):
		each_str = input()
		for each_letter in each_str:
			count_letter[ord(each_letter) - 97] += 1
	is_YES = True
	for item in count_letter:
		if item % no_of_strings != 0:
			is_YES = False
			break
	if is_YES:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	dic = {}
	for i in range(n):
		s = input()
		for ch in s:
			if ch not in dic:
				dic[ch] = 1
			else:
				dic[ch] += 1
	ok = True
	for item in dic:
		if dic[item] % n != 0:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')
	t -= 1


from collections import Counter
from itertools import chain
t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	flag = 0
	for i in range(n):
		a.extend(list(input()))
	res = dict(Counter(chain.from_iterable(map(set, a))))
	for i in res.values():
		if i % n == 0:
			continue
		else:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = ''
	for _ in range(n):
		s = s + input()
	d = Counter(s)
	for key in d.values():
		if key % n == 0:
			f = 0
		else:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	str_array = []
	for j in range(n):
		string = input()
		str_array.append(string)
	running = True
	index_1 = 0
	index_2 = 0
	checked_chars = []
	while running:
		count = 0
		curr_char = str_array[index_1][index_2]
		checked_chars.append(curr_char)
		for j in range(len(str_array)):
			for char in str_array[j]:
				if char == curr_char:
					count += 1
		if count / n != count // n:
			print('NO')
			running = False
			break
		else:
			while curr_char == str_array[index_1][index_2]:
				if index_1 == n - 1 and index_2 == len(str_array[index_1]) - 1:
					print('YES')
					running = False
					break
				elif index_2 + 1 == len(str_array[index_1]):
					index_1 += 1
					index_2 = 0
				else:
					index_2 += 1


t = int(input())
for _ in range(t):
	s = []
	n = int(input())
	for i in range(n):
		s += input()
	chars = dict()
	check = True
	for i in s:
		chars[i] = chars.get(i, 0) + 1
	for i in chars:
		if chars[i] % n != 0:
			check = False
	if check == True:
		print('YES')
	else:
		print('NO')


import sys
from math import sqrt
from collections import defaultdict
inpt = sys.stdin.readline

def inp():
	return int(inpt())

def inlist():
	return list(map(int, inpt().split()))

def instr():
	s = inpt()
	return list(s[:len(s) - 1])

def invr():
	return map(int, inpt().split())

class Graph:

	def __init__(self, n):
		self.n = n
		self.graph = defaultdict(list)
		self.marked = defaultdict(int)

	def addEdge(self, u, v):
		self.graph[u].append(v)
		self.graph[v].append(u)

	def dfs(self, u):
		self.marked[u] = 1
		for i in self.graph[u]:
			if self.marked[i] == 0:
				self.dfs(i)

def main():
	t = inp()
	for f in range(t):
		n = inp()
		s = [''] * n
		letters = defaultdict(int)
		for i in range(n):
			s[0] = instr()
			for x in s[0]:
				letters[x] += 1
		flag = True
		for x in letters:
			if letters[x] % n != 0:
				flag = False
				break
		if flag == False:
			print('NO')
		else:
			print('YES')
main()


from collections import Counter

def func(A, n):
	A = Counter(A)
	for i in A:
		if A[i] % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	A = []
	for i in range(n):
		A.extend(list(input()))
	print(func(A, n))


t = int(input())
for _ in range(t):
	n = int(input())
	li = []
	for i in range(n):
		s = input()
		li.append(s)
	d = {}
	for i in li:
		for j in i:
			if j not in d:
				d[j] = 1
			else:
				d[j] += 1
	flag = 1
	for i in d:
		if d[i] % n != 0:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = [S() for _ in range(n)]
		c = collections.defaultdict(int)
		for s in a:
			for t in s:
				c[t] += 1
		rr.append(IF(all((v % n == 0 for v in c.values())), 'YES', 'NO'))
	return JA(rr, '\n')
print(main())


def solve(count, n):
	for i in count:
		if i % n != 0:
			return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		s = input()
		print('YES')
	else:
		count = [0 for i in range(30)]
		for i in range(n):
			s = input()
			for j in s:
				idx = ord(j) - ord('a')
				count[idx] += 1
		ans = solve(count, n)
		print('YES' if ans else 'NO')


query = int(input())
for i in range(query):
	size = int(input())
	count = [0] * 26
	for j in range(size):
		str = input()
		for k in str:
			count[ord(k) - 97] += 1
	f = 0
	for j in range(26):
		if count[j] % size != 0:
			print('NO')
			f = -1
			break
	if f == 0:
		print('YES')


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	a = [0] * 26
	for i in range(n):
		s = inputstringnum()
		for j in range(len(s)):
			a[s[j]] += 1
	good = True
	for i in range(26):
		if a[i] % n != 0:
			good = False
			break
	if good:
		print('YES')
	else:
		print('NO')


t = int(input())
for case in range(t):
	n = int(input())
	letter_dict = {}
	answer = 'YES'
	for i in range(n):
		word = input()
		for char in word:
			if char in letter_dict.keys():
				letter_dict[char] += 1
			else:
				letter_dict[char] = 1
	for char in letter_dict.keys():
		if letter_dict[char] % n != 0:
			answer = 'NO'
			break
	print(answer)


num_cases = int(input())
output = []
for i in range(num_cases):
	strings = []
	num_strings = int(input())
	for j in range(num_strings):
		temp_string = input()
		strings.append(temp_string)
	single_char = []
	total_char = []
	for a in range(num_strings):
		for b in range(len(strings[a])):
			total_char.append(strings[a][b])
			if strings[a][b] not in single_char:
				single_char.append(strings[a][b])
	for t in range(len(single_char)):
		if total_char.count(single_char[t]) % num_strings != 0:
			output.append('NO')
			break
	else:
		output.append('YES')
for i in range(len(output)):
	print(output[i])


t = int(input())
while t > 0:
	n = int(input())
	d = {}
	flag = 0
	for i in range(n):
		c = input()
		for j in c:
			if j not in d:
				d[j] = 1
			else:
				d[j] += 1
	for i in d:
		if d[i] % n != 0:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
while t:
	t -= 1
	n = int(input())
	dic = {}
	for _ in range(n):
		s = input()
		for ele in s:
			if ele in dic.keys():
				dic[ele] += 1
			else:
				dic[ele] = 1
	ans = list(dic.values())
	c = 1
	for ele in ans:
		if ele % n != 0:
			c = 0
			print('NO')
			break
	if c:
		print('YES')


class solution:

	def __init__(self, n, s):
		self.n = n
		self.s = s
		self.answer = ''

	def calculation(self):
		d = {}
		for i in s:
			for j in i:
				if j in d:
					d[j] += 1
				else:
					d[j] = 1
		for k in d:
			if d[k] % n != 0 or d[k] < n:
				self.answer = 'NO'
		if not self.answer:
			self.answer = 'YES'
t = int(input())
for _ in range(t):
	s = []
	n = int(input())
	for i in range(n):
		a = input()
		s.append(a)
	root = solution(n, s)
	root.calculation()
	print(root.answer)


def fun1(l):
	d = {}
	for _string in l:
		for letter in _string:
			if letter not in d:
				d[letter] = 0
			d[letter] += 1
	for (key, values) in d.items():
		if values % len(l) != 0:
			return 'NO'
	return 'YES'

def unique(s):
	_s = ''
	for letter in s:
		if letter not in _s:
			_s += letter
	return _s
test_case = int(input())
ans = []
for i in range(test_case):
	n = int(input())
	strings = []
	for _ in range(n):
		x = input()
		strings.append(x)
	ans.append(fun1(strings))
for i in ans:
	print(i)


t = int(input())
answer = []
for i in range(t):
	n = int(input())
	string = ''
	dict = {}
	for j in range(n):
		string += input()
	for index in range(len(string)):
		if string.index(string[index]) == index:
			dict[string[index]] = 1
		else:
			dict[string[index]] += 1
	for value in dict.values():
		if value % n != 0:
			answer.append('NO')
			break
	else:
		answer.append('YES')
for i in answer:
	print(i)


for p in range(int(input())):
	n = int(input())
	arr = []
	for i in range(n):
		arr.append(input())
	dic = {}
	for d in arr:
		for r in d:
			if r not in dic:
				dic[r] = 0
			dic[r] += 1
	fl = 0
	for d in dic:
		if dic[d] % n != 0:
			print('NO')
			fl = 1
			break
	if fl == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	sl = []
	for i in range(n):
		sl.append(input())
	d = {}
	for i in range(n):
		for j in sl[i]:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	f = 0
	for i in d:
		if d[i] % n != 0:
			f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	d = Counter()
	k = 0
	for j in range(n):
		a = input()
		d = Counter(a) + d
	for i in d:
		if d[i] % n == 0:
			continue
		else:
			print('NO')
			k = 1
			break
	if k == 0:
		print('YES')


from collections import Counter

def f():
	t = int(input())
	arr = []
	for _ in range(t):
		numstr = int(input())
		c = Counter()
		for _ in range(numstr):
			s = input()
			c.update(s)
		arr.append((c, numstr))
	for (Ctr, n) in arr:
		tf = True
		for k in Ctr:
			if Ctr[k] % n != 0:
				tf = False
				print('NO')
				break
		if tf:
			print('YES')
f()


from math import gcd, ceil
from collections import Counter, deque
from heapq import heappush, heappop, heapify

def rl():
	return list(map(int, input().split()))

def arp(arr):
	return ' '.join([str(i) for i in arr])
for _ in range(int(input())):
	n = int(input())
	arr = ''
	m = n
	while n:
		n -= 1
		ss = input()
		arr += ss
	d = Counter(arr)
	val = list(d.values())
	f = all((i % m == 0 for i in val))
	if f:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	p = {}
	for j in range(n):
		for k in input():
			if k in p:
				p[k] += 1
			else:
				p[k] = 1
	for j in p:
		if p[j] % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	(res, s) = ('YES', [])
	for _ in range(n):
		s.append(input())
	char = [0] * 26
	for string in s:
		for i in string:
			char[ord(i) - ord('a')] += 1
	for ch in char:
		if ch % n != 0:
			res = 'NO'
			break
	print(res)


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		s = list(input())
		l = l + s
	f = 1
	st = list(set(l))
	for i in st:
		if l.count(i) % n != 0:
			f = 0
	if f == 1:
		print('YES')
	else:
		print('NO')


import sys
import time
FIO = 10

def I():
	return input()

def Iint():
	return int(input())

def Ilist():
	return list(map(int, input().split()))

def Imap():
	return map(int, input().split())

def Plist(li, s=' '):
	print(s.join(map(str, li)))
en = enumerate

def answer_debug(*args):
	print('\x1b[31m', *args, '\x1b[0m', file=sys.stderr)

def debug(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
if not FIO:
	if __name__ == '__main__':
		main()
		exit()
else:
	from io import BytesIO, IOBase
	import os
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		l = []
		for _ in range(n):
			l += list(input())
		s = list(set(l))
		for i in s:
			if l.count(i) % n != 0:
				print('NO')
				break
		else:
			print('YES')
main()


t = int(input())
for abc in range(t):
	num = int(input())
	string = ''
	for i in range(num):
		string += input()
	s1 = set(string)
	for i in s1:
		if string.count(i) % num != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [0] * 26
	for i in range(n):
		temp = input()
		le = len(temp)
		for j in range(le):
			val = ord(temp[j])
			arr[val - 97] += 1
	ans = True
	for i in range(26):
		if arr[i] % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for z in range(t):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			if j not in d:
				d[j] = 0
			d[j] += 1
	ok = True
	for i in d:
		if d[i] % n != 0:
			ok = False
	if ok:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s1 = ''
	for i in range(n):
		s = input()
		s1 = s1 + s
	s1 = list(s1)
	s2 = []
	c = 0
	flag = 1
	for i in range(len(s1)):
		if s1[i] not in s2:
			c = s1.count(s1[i])
			s2.append(s1[i])
		if c % n != 0:
			flag = 0
			break
		else:
			flag = 1
	if flag == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	m = {}
	for i in range(n):
		x = str(input())
		for j in x:
			if j in m:
				m[j] += 1
			else:
				m[j] = 1
	q = list(m.values())
	f = 0
	for w in q:
		if w % n != 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


import sys
from collections import Counter
input = lambda : sys.stdin.readline().rstrip('\r\n')

def solve():
	n = int(input())
	t = ''
	for i in range(n):
		t += input()
	d = Counter(t)
	ok = False
	for (k, v) in d.items():
		if v % n != 0:
			ok = True
	print('YES' if not ok else 'NO')
for _ in range(int(input())):
	solve()


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	s = ''
	for j in range(n):
		s += input()
	s_dict = Counter(s)
	flag = 0
	for j in s_dict.keys():
		if s_dict[j] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for x in range(0, t):
	i = int(input())
	dict_char = {}
	for y in range(0, i):
		ip_str = input()
		for char in ip_str:
			if dict_char.get(char):
				dict_char[char] += 1
			else:
				dict_char[char] = 1
	code_break = False
	for (char, freq) in dict_char.items():
		if freq % i != 0:
			code_break = True
			print('NO')
			break
	if not code_break:
		print('YES')


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	n = int(sys.stdin.readline().strip())
	s = ''
	for i in range(n):
		s += sys.stdin.readline().strip()
	(c, flag) = (0, 0)
	wd = list(set(s))
	for i in range(len(wd)):
		c = s.count(wd[i])
		if c % n == 0:
			flag += 1
	if flag == len(wd):
		print('YES')
	else:
		print('NO')


def letterdivisible():
	nbstring = int(input())
	dict = {}
	for _ in range(nbstring):
		for char in input():
			if char in dict:
				dict[char] += 1
			else:
				dict[char] = 1
	booleen = True
	for nbchar in dict.values():
		booleen &= nbchar % nbstring == 0
	if booleen:
		print('YES')
	else:
		print('NO')

def main():
	n = int(input())
	for _ in range(n):
		letterdivisible()
main()


t = int(input())
for k in range(t):
	n = int(input())
	d = dict()
	f = 0
	for i in range(n):
		s = input()
		for w in s:
			d[w] = d.get(w, 0) + 1
	for i in d:
		if d[i] % n != 0:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


for _ in range(int(input())):
	d = {}
	t = ''
	key = True
	n = int(input())
	for _1 in range(n):
		s = input()
		t = t + s
	for i in t:
		d[i] = 0
	for i in t:
		d[i] += 1
	for i in d.values():
		if i % n == 0:
			continue
		else:
			key = False
			break
	if key:
		print('YES')
	else:
		print('NO')


def juggle_letter(arr, n):
	if len(arr) == 1:
		return 'YES'
	s = ''.join(arr)
	t = list(set(s))
	for i in t:
		if s.count(i) % n:
			return 'NO'
	else:
		return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	for _ in range(n):
		arr.append(input())
	print(juggle_letter(arr, n))


for _ in range(int(input())):
	n = int(input())
	a = [chr(i) for i in range(65, 91)]
	a.extend([chr(i) for i in range(97, 97 + 26)])
	flag = True
	count = [0] * 52
	for s in range(n):
		s = input()
		s = list(s)
		for i in range(52):
			count[i] += s.count(a[i])
	for i in range(52):
		if count[i] % n != 0:
			flag = False
			break
	if flag == True:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	n = int(input())
	lis = []
	for i in range(n):
		str = input()
		lis.append(str)
	tot = ''
	for char in lis:
		tot = tot + char
	tot = ''.join(sorted(tot))
	new_lis = [1]
	k = 0
	for j in range(1, len(tot)):
		if tot[j - 1] == tot[j]:
			new_lis[k] = new_lis[k] + 1
		else:
			k = k + 1
			new_lis.append(0)
			new_lis[k] = new_lis[k] + 1
	su = []
	for num in new_lis:
		if num % n != 0:
			su.append(0)
		else:
			su.append(1)
	if 0 in su:
		print('NO')
	else:
		print('YES')
	t = t - 1


import os
import sys
from io import BytesIO, IOBase
import threading
from collections import defaultdict, Counter, deque
from math import factorial as fac

def main():
	t = int(input())
	for _ in range(t):
		count = defaultdict(int)
		n = int(input())
		for _ in range(n):
			s = input()
			for c in s:
				count[c] += 1
			YES = True
			for (k, v) in count.items():
				if v % n != 0:
					YES = False
					break
		if YES:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i1 in range(int(input())):
	n = int(input())
	dict = {}
	for i in range(n):
		s = input()
		s = s.replace('\r', '')
		for j in s:
			if j not in dict:
				dict[j] = 1
			else:
				dict[j] += 1
	flag = 0
	for (i, j) in dict.items():
		if j % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


from collections import Counter

def pos(n):
	e = ''
	for i in range(n):
		k = input()
		e += k
	l = Counter(e)
	for (i, j) in l.items():
		if j % n != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	print(pos(n))


letters = dict()
testCases = int(input())
result = 'YES'
for x in range(testCases):
	strings = int(input())
	userString = ''
	for y in range(strings):
		userString = userString + input()
	stringAsList = list(userString)
	listAsSet = set(stringAsList)
	for letter in listAsSet:
		if stringAsList.count(letter) % strings != 0:
			result = 'NO'
			break
	print(result)
	result = 'YES'


t = int(input())
a = [0] * t
for i in range(t):
	n = int(input())
	string = [0] * n
	for j in range(n):
		string[j] = input()
	newstring = str()
	for j in range(n):
		newstring = newstring + string[j]
	count = [0] * 26
	for j in range(len(newstring)):
		for k in range(97, 123):
			if chr(k) == newstring[j]:
				count[k - 97] = count[k - 97] + 1
	flag = 0
	for j in range(len(count)):
		if count[j] % n != 0:
			flag = 1
			break
	if flag == 1:
		a[i] = 0
	else:
		a[i] = 1
for i in range(t):
	if a[i] == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	(raw, cnt) = ([], [])
	n = int(input())
	q = n
	while n:
		s = input()
		for i in range(len(s)):
			if s[i] in raw:
				cnt[raw.index(s[i])] += 1
			else:
				raw.append(s[i])
				cnt.append(1)
		n -= 1
	flag = True
	for _ in cnt:
		if _ % q != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


import math
que = int(input())
for i in range(que):
	ls = [0] * 26
	n = int(input())
	for i in range(n):
		s = input()
		for cha in s:
			ls[int(ord(cha) - ord('a'))] += 1
	solve = True
	for i in ls:
		if i % n != 0:
			solve = False
			break
	if solve:
		print('YES')
	else:
		print('NO')


from collections import defaultdict

def soln(arr):
	n = len(arr)
	table = defaultdict(int)
	for s in arr:
		for c in s:
			table[c] += 1
	for (k, v) in table.items():
		if v % n != 0:
			return 'NO'
	return 'YES'

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = [input() for _ in range(n)]
		result = soln(arr)
		print(result)
main()


def func():
	i = int(input())
	s = ''
	d = {}
	for k in range(i):
		s += input()
	for k in s:
		if k in d:
			d[k] += 1
		else:
			d[k] = 1
	for k in d:
		if d[k] % i != 0:
			return 'NO'
	return 'YES'
i = int(input())
for k in range(i):
	print(func())


def solution():
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			d[j] = d.get(j, 0) + 1
	flag = 0
	for i in d:
		if d[i] % n:
			flag = 1
	if flag:
		print('NO')
	else:
		print('YES')
t = int(input())
for _ in range(t):
	solution()


T = int(input())
res = list()
for _ in range(T):
	n = int(input())
	r = list()
	for _ in range(n):
		x = input()
		r.append(x)
	if len(r) == 1 and n == 1:
		res.append('YES')
		continue
	s = ''
	for i in r:
		s += i
	dictionary = dict()
	for i in s:
		if i in dictionary:
			dictionary[i] += 1
		else:
			dictionary[i] = 1
	ok = False
	for i in dictionary:
		if dictionary[i] % n == 0:
			ok = True
		else:
			res.append('NO')
			ok = False
			break
	if ok:
		res.append('YES')
for i in res:
	print(i)


def can_make_equal(arr):
	letter_map = {}
	for word in arr:
		for letter in word:
			letter_map[letter] = letter_map.get(letter, 0) + 1
	for letter in letter_map:
		if letter_map[letter] % len(arr) != 0:
			return False
	return True
for _ in range(int(input())):
	words = []
	for i in range(int(input())):
		words.append(input())
	print('YES' if can_make_equal(words) else 'NO')


t = int(input())
while t > 0:
	n = int(input())
	li = ''
	for i in range(n):
		li += input()
	var = list(set(li))
	res = True
	for i in var:
		if li.count(i) % n != 0:
			res = False
			break
	if res:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = input()
	for i in range(n - 1):
		a += input()
	a = list(a)
	a.sort()
	j = 0
	l = len(a)
	while j < l:
		x = a[j]
		count = 1
		i = j + 1
		while i < l and a[i] == x:
			count += 1
			i += 1
		j += count
		if count % n != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = {}
	for i in range(n):
		lol = input()
		for j in lol:
			if j not in arr:
				arr[j] = 1
			else:
				arr[j] += 1
	c = 0
	for i in arr:
		if arr[i] % n != 0:
			c = 1
			break
	if c == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	t -= 1
	n = int(input())
	ans = 0
	ap = [0 for i in range(26)]
	alp = 'qwertyuiopasdfghjklzxcvbnm'
	alp = list(alp)
	alp.sort()
	for i in range(n):
		a = input()
		for j in a:
			ap[alp.index(j)] += 1
	l = []
	for i in ap:
		if i:
			l.append(i)
	flag = 0
	fin = set()
	for i in l:
		if i % n:
			flag += 1
			break
		else:
			fin.add(i / n)
	if flag:
		print('NO')
	else:
		print('YES')


from collections import defaultdict
for t in range(int(input())):
	n = int(input())
	strs = [input() for _ in range(n)]
	cnts = defaultdict(int)
	for s in strs:
		for ch in s:
			cnts[ch] += 1
	ans = all((v % n == 0 for v in cnts.values()))
	print('YES' if ans else 'NO')


from sys import stdin
for _ in range(int(input())):
	cnt = [0] * 26
	n = int(input())
	for i in range(n):
		for j in input():
			cnt[ord(j) - ord('a')] += 1
	f = True
	for i in range(26):
		if cnt[i] % n:
			f = False
			break
	print('YES' if f else 'NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l += input()
	count = Counter(l)
	ans = 'YES'
	arr = count.values()
	for i in arr:
		if i % n != 0:
			ans = 'NO'
			break
	print(ans)


def answer(n, test_str):
	res = {}
	for i in test_str:
		for keys in i:
			res[keys] = res.get(keys, 0) + 1
	for i in res.values():
		if i % n != 0:
			return 'NO'
	return 'YES'
try:
	for z in range(int(input())):
		n = int(input())
		ar = []
		for i in range(n):
			ar.append(input())
		print(answer(n, ar))
except EOFError:
	print(end='')


t = int(input())
for _ in range(t):
	d = {}
	n = int(input())
	for i in range(n):
		for char in input():
			if char not in d:
				d[char] = 0
			d[char] += 1
	done = False
	for (char, count) in d.items():
		if count % n != 0:
			print('NO')
			done = True
			break
	if not done:
		print('YES')


from collections import Counter
t = int(input())
l = []
for i in range(t):
	n = int(input())
	str = ''
	count = 0
	all_freq = {}
	for j in range(n):
		s = input()
		l.append(s)
		str += s
	for k in str:
		if k in all_freq:
			all_freq[k] += 1
		else:
			all_freq[k] = 1
	for value in all_freq.values():
		if value % n == 0:
			count += 1
		else:
			pass
	if count == len(all_freq):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = []
	for i in range(n):
		a.append(input())
	b = ''
	for i in a:
		b = b + i
	all_freq = {}
	for i in b:
		if i in all_freq:
			all_freq[i] += 1
		else:
			all_freq[i] = 1
	fre = []
	for (key, value) in all_freq.items():
		fre.append(value)
	for i in fre:
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	cnt = {}
	for i in range(n):
		s = input()
		for j in s:
			try:
				cnt[j] += 1
			except KeyError:
				cnt[j] = 1
	flag = True
	for i in cnt:
		if cnt[i] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
res = []
from functools import reduce
from collections import Counter

def check(n, temp):
	if len(temp) < 2:
		return 'YES'
	c = Counter(reduce(lambda x, y: x + y, temp))
	for i in c.values():
		if i < len(temp):
			return 'NO'
		if i % len(temp) != 0:
			return 'NO'
	return 'YES'
for _ in range(t):
	temp = []
	n = int(input())
	for __ in range(n):
		temp.append(input())
	res.append(check(n, temp))
for i in res:
	print(i)


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
sys.setrecursionlimit(10 ** 5)

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def solve():
	c = {}
	n = II()
	for _ in range(n):
		for char in input():
			if char in c:
				c[char] += 1
			else:
				c[char] = 1
	good = True
	for val in c.values():
		if val % n != 0:
			good = False
	if good:
		print('YES')
	else:
		print('NO')
for _ in range(II()):
	solve()


from sys import stdin
for _ in range(int(stdin.readline())):
	array = [0] * 26
	n = int(stdin.readline())
	flag = True
	for __ in range(n):
		string = stdin.readline().strip()
		for i in string:
			array[ord(i) - 97] += 1
	for i in array:
		if i % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	string = ''
	for _ in range(n):
		s = input()
		string += s
	count = Counter(string)
	keys = list(count.keys())
	ans = True
	for i in range(len(keys)):
		if count[keys[i]] % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


import sys
from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	d = dict(Counter(s))
	lol = list(d.values())
	for i in range(len(lol)):
		lol[i] %= n
	lol = set(lol)
	if len(lol) == 1 and 0 in lol:
		print('YES')
	else:
		print('NO')


t = int(input())
for t in range(t):
	n = int(input())
	s = ''
	for i in range(n):
		s = s + input()
	l = list(set(list(s)))
	c = []
	for i in l:
		c.append(s.count(i))
	d = 0
	for i in c:
		if i % n != 0:
			d = 1
			break
	if d == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = int(input())
	x = []
	y = []
	for b in range(a):
		c = list(str(input()))
		x = x + c
	for z in x:
		if z not in y:
			y.append(z)
			d = x.count(z)
			if d % a != 0:
				print('NO')
				break
	if d % a == 0:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	d = 0
	for i in range(n):
		a = input()
		a = list(a)
		arr.extend(a)
	arr1 = list(set(arr))
	for i in arr1:
		if arr.count(i) % n == 0:
			d += 1
	if d == len(arr1):
		print('YES')
	else:
		print('NO')


def jugglingLetters():
	for t in range(int(input())):
		success = 1
		n = int(input())
		ch = [0] * 256
		for i in range(n):
			s = list(input())
			for j in s:
				ch[ord(j)] += 1
		for i in range(256):
			if ch[i] % n != 0:
				print('NO')
				success = 0
				break
		if success == 1:
			print('YES')
jugglingLetters()


t = int(input())
for _ in range(t):
	n = int(input())
	dic = {}
	for i in range(n):
		s = input()
		for i in s:
			if i in dic.keys():
				dic[i] += 1
			else:
				dic[i] = 1
	flag = 0
	for i in dic.values():
		if i % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


from math import *
t = int(input())
for _ in range(t):
	l = [0] * 26
	n = int(input())
	for i in range(n):
		s = input()
		for j in range(len(s)):
			k = ord(s[j]) - ord('a')
			l[k] = l[k] + 1
	for i in range(26):
		p = l[i] % n
		if p != 0:
			print('NO')
			break
	else:
		print('YES')


from math import *
from collections import *
from itertools import *
from functools import *
from bisect import *
from heapq import *
from operator import *
from sys import *
setrecursionlimit(100000000)
for _ in range(int(input())):
	n = int(input())
	c = Counter()
	for i in range(n):
		c.update(input())
	for x in c:
		if c[x] % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
res = [0] * t
for k in range(t):
	d = {}
	slist = []
	n = int(input())
	for i in range(n):
		s = str(input())
		slist.append(s)
	for i in range(n):
		for j in slist[i]:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	for val in d.values():
		if val % n != 0:
			res[k] = 'NO'
			break
		res[k] = 'YES'
for i in res:
	print(i)


casos = int(input())
resultados = []
for i in range(casos):
	cantidadStrings = int(input())
	lista = []
	letras = [['q', 0], ['w', 0], ['e', 0], ['r', 0], ['t', 0], ['y', 0], ['u', 0], ['i', 0], ['o', 0], ['p', 0], ['a', 0], ['s', 0], ['d', 0], ['f', 0], ['g', 0], ['h', 0], ['j', 0], ['k', 0], ['l', 0], ['z', 0], ['x', 0], ['c', 0], ['v', 0], ['b', 0], ['n', 0], ['m', 0]]
	positivo = True
	for j in range(cantidadStrings):
		lista.append(input())
		for h in range(len(lista[j])):
			for g in range(len(letras)):
				if lista[j][h] == letras[g][0]:
					letras[g][1] = letras[g][1] + 1
	for j in range(len(letras)):
		if letras[j][1] != 0 and letras[j][1] % cantidadStrings != 0:
			resultados.append('NO')
			positivo = False
			break
	if positivo:
		resultados.append('YES')
for i in range(len(resultados)):
	print(resultados[i])


import collections

def find(d):
	for i in d:
		if d[i] % n != 0:
			return 'NO'
	return 'YES'
T = int(input())
for _ in range(T):
	n = int(input())
	d = collections.defaultdict(int)
	for _ in range(n):
		s = input().strip()
		for i in s:
			d[i] += 1
	print(find(d))


t = int(input())
for bquxxxxxcxwegwheftwefhdgfgd in range(t):
	n = int(input())
	z = []
	zz = []
	for i in range(n):
		s = list(input())
		for j in s:
			z.append(j)
	flag = 0
	for k in z:
		su = z.count(k)
		if su % n != 0:
			flag = 1
			break
		else:
			flag = 0
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	lst = []
	for i in range(n):
		s = input()
		lst.append(s)
	d = {}
	for i in lst:
		for j in i:
			if j not in d:
				d[j] = 0
			d[j] += 1
	g = True
	for k in d.keys():
		if d[k] % n != 0:
			g = False
	if g:
		print('YES')
	else:
		print('NO')


for aww in range(int(input())):
	b = int(input())
	c = []
	for i in range(b):
		c += [i for i in input()]
	d = list(set(c))
	e = []
	for i in d:
		e.append(c.count(i))
	f = 0
	for i in e:
		if i % b != 0:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')


import math
import collections
t = int(input())
for _ in range(0, t):
	n = int(input())
	c = {}
	for i in range(0, n):
		x = input()
		x = list(x)
		for i in range(0, len(x)):
			if x[i] not in c:
				c[x[i]] = 1
			else:
				c[x[i]] += 1
	flag = 1
	for (key, value) in c.items():
		if value % n == 0:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


from collections import Counter
TC = int(input())
while TC > 0:
	n = int(input())
	a = ''
	for i in range(n):
		a += input()
	cnt = Counter(a)
	flag = True
	for x in cnt.values():
		if x % n != 0:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')
	TC -= 1


for t in range(int(input())):
	alpha = [0 for i in range(26)]
	n = int(input())
	for i in range(n):
		for j in input():
			alpha[ord(j) - ord('a')] += 1
	flg = True
	for i in alpha:
		if i % n:
			flg = False
			break
	if flg:
		print('YES')
	else:
		print('NO')


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	all_char_count = {}
	for _ in range(n):
		s = input()
		char_count: dict = Counter(s)
		for (key, val) in char_count.items():
			if key in all_char_count:
				all_char_count[key] += char_count[key]
			else:
				all_char_count[key] = char_count[key]
	is_equal = True
	for val in all_char_count.values():
		if val % n != 0:
			is_equal = False
			break
	if is_equal:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	bh = ''
	for i in range(n):
		s = input()
		bh += s
	x = list(set(bh))
	c = 0
	for i in x:
		if bh.count(i) % n == 0:
			c = c + 1
	if c == len(x):
		print('YES')
	else:
		print('NO')


from collections import Counter
t = int(input())
for i in range(t):
	elements = Counter()
	flag = 'YES'
	n = int(input())
	for j in range(n):
		str = input()
		for s in str:
			elements[s] += 1
	for val in elements.values():
		if val % n != 0:
			flag = 'NO'
			break
	print(flag)


def stringsEqual(L):
	h = {}
	for i in range(len(L)):
		for alph in range(len(L[i])):
			res = h
			eq = False
			for key in h:
				if L[i][alph] == key:
					h[L[i][alph]] += 1
					eq = True
			if eq == False:
				h[L[i][alph]] = 1
	for a in h:
		if h[a] % len(L) != 0:
			return 'NO'
	return 'YES'
T = int(input())
while T > 0:
	T -= 1
	n = int(input())
	inp = []
	for i in range(n):
		inp.append(input())
	print(stringsEqual(inp))


t = int(input())
for _ in [0] * t:
	n = int(input())
	lst = []
	s = ''
	for i in range(n):
		lst.append(input())
		s = s + lst[-1]
	for i in range(len(s)):
		if s.count(s[i]) % n == 0:
			x = 1
		else:
			x = 0
			break
	if x == 1:
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for char in s:
			if char not in d:
				d[char] = 0
			d[char] += 1
	for value in d.values():
		if value % n != 0:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	solve()


from collections import Counter

def main():
	n = int(input())
	s = ''
	for _ in range(n):
		s += input()
	c = Counter(s)
	for i in c:
		if c[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')
t = int(input())
for _ in range(t):
	main()


try:
	from collections import Counter
	t = int(input())
	while t != 0:
		n = int(input())
		string = ''
		for i in range(n):
			p = input()
			string += p
		string = list(string)
		count_num = Counter(string)
		sss = count_num.most_common()
		result = 1
		for i in range(len(sss)):
			if sss[i][1] % n != 0:
				result = 0
				break
		if result == 0:
			print('NO')
		else:
			print('YES')
		t = t - 1
except EOFError:
	print(' ')


t = int(input())
for t_index in range(t):
	n = int(input())
	symbols = {}
	for i in range(n):
		s = input()
		for item in s:
			try:
				symbols[item] += 1
			except:
				symbols[item] = 1
	found = False
	for (key, item) in symbols.items():
		if item % n != 0:
			found = True
			break
	print('NO' if found else 'YES')


t = int(input())
for _ in range(t):
	n = int(input())
	lst = []
	for i in range(n):
		lst.append(input())
	cnt = [0 for i in range(27)]
	for i in range(len(lst)):
		s1 = lst[i]
		for j in range(len(s1)):
			cnt[ord(s1[j]) - ord('a')] += 1
	flag = True
	for i in range(len(cnt)):
		if cnt[i] % n != 0:
			flag = False
			break
	if flag != False:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = int(input())
	b = {}
	for j in range(a):
		c = input()
		for k in c:
			if k not in b:
				b[k] = 0
			b[k] += 1
	flag = True
	for j in b:
		if b[j] % a != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
for tt in range(t):
	n = int(input())
	s = []
	m = defaultdict(int)
	for i in range(n):
		s += [input()]
		for l in s[-1]:
			m[l] += 1
	ok = True
	for e in m:
		if m[e] % n != 0:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	N = int(input())
	Lst = []
	for _ in range(N):
		Str = input()
		Lst = Lst + list(Str)
	Set = set(Lst)
	for x in Set:
		Val = Lst.count(x)
		if Val % N == 0:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	l = [0] * 26
	n = int(input())
	for i in range(n):
		s = input()
		for j in s:
			l[ord(j) - 97] += 1
	u = 0
	for i in range(26):
		if l[i] % n != 0:
			print('NO')
			u = 1
			break
	if u == 0:
		print('YES')


import sys
import math
from collections import defaultdict
input = sys.stdin.readline

def get_int():
	return int(input().strip())

def get_int_list():
	return list(map(int, input().strip().split()))

def get_char_list():
	return list(input().strip())
cases = get_int()
for _ in range(cases):
	n = get_int()
	element_count = defaultdict(int)
	for _ in range(n):
		st = get_char_list()
		for c in st:
			element_count[c] += 1
	bad = False
	for k in element_count.keys():
		if element_count[k] % n != 0:
			bad = True
			break
	if bad:
		print('NO')
	else:
		print('YES')


a = int(input())
for i in range(a):
	n = int(input())
	nlist = []
	for i in range(n):
		i = input()
		nlist.append(i)
	letterlist = []
	numlist = []
	for element in nlist:
		for char in element:
			if char in letterlist:
				for i in range(len(letterlist)):
					if letterlist[i] == char:
						numlist[i] += 1
			else:
				letterlist.append(char)
				numlist.append(1)
	check = 0
	for num in numlist:
		if num % n != 0:
			check += 1
	if check == 0:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for ch in s:
			d[ch] = d.get(ch, 0) + 1
	ans = 'YES'
	for k in d:
		if d[k] % n != 0:
			ans = 'NO'
			break
	print(ans)


rw = int(input())
for wewq in range(rw):
	n = int(input())
	a = [[] for i in range(n)]
	for i in range(n):
		a[i] = list(input())
	s = {}
	for i in a:
		for j in i:
			s[j] = 0
	for i in a:
		for j in i:
			s[j] += 1
	for i in s.values():
		if i % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	m = dict()
	for i in range(n):
		s = input()
		for c in s:
			m[c] = m.get(c, 0) + 1
	good = True
	for k in m.values():
		if k % n != 0:
			good = False
	print('YES' if good else 'NO')


t = int(input())
while t > 0:
	counts = dict()
	str = ''
	a = []
	n = int(input())
	for i in range(n):
		str = str + input()
	for s in str:
		counts[s] = counts.get(s, 0) + 1
	for i in counts.values():
		a.append(i)
	check = 0
	for i in range(len(a)):
		if a[i] % n != 0:
			check = 1
			break
	if check == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	arr = {}
	for i in range(n):
		lis = input()
		for j in lis:
			if j in arr:
				arr[j] += 1
			else:
				arr[j] = 1
	flag = True
	for i in arr.keys():
		if arr[i] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


from collections import Counter

def str():
	count = int(input())
	data_lst = ''
	a = 0
	c = 0
	for i in range(count):
		count_str = int(input())
		for j in range(count_str):
			data_lst += input()
		for i in range(count):
			a = Counter(data_lst)
		a = list(a.values())
		for i in range(len(a)):
			if a[i] % count_str == 0:
				c += 1
		if c == len(a):
			print('YES')
		else:
			print('NO')
		data_lst = ''
		a = 0
		c = 0
str()


alph = __import__('string').ascii_lowercase
for _ in range(int(input())):
	n = int(input())
	g = {i: 0 for i in alph}
	for _ in range(n):
		for i in input():
			g[i] += 1
	print('YNEOS'[any((g[i] % n for i in g))::2])


for t in range(int(input())):
	n = int(input())
	arr = []
	flag = 0
	for i in range(n):
		arr.append([str(k) for k in input()])
	di = {}
	for ele in arr:
		for li in ele:
			if li in di:
				di[li] += 1
			else:
				di[li] = 1
	for ele in di:
		if di[ele] % n != 0:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	counts = [0] * 26
	for i in range(n):
		for letter in input():
			counts[ord(letter) - 97] += 1
	for count in counts:
		if count % n:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(0, t):
	n = int(input())
	flag = 0
	lst = []
	lst1 = []
	for i in range(0, n):
		st = input()
		lst = list(st)
		lst1 = lst1 + lst
	for i in lst1:
		if lst1.count(i) < n or lst1.count(i) % n != 0:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


ans = []
n = int(input())
for test in range(n):
	tt = 0
	dict = {}
	A = []
	k = int(input())
	for a in range(k):
		t = input()
		A.append(t)
	for a in range(k):
		for letter in A[a]:
			if letter in dict.keys():
				dict[letter] = dict[letter] + 1
			else:
				dict[letter] = 1
	for letter in dict.keys():
		if dict[letter] % k == 0:
			pass
		else:
			tt = 1
			break
	if tt == 0:
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


for _ in range(int(input())):
	n = int(input())
	li = []
	for i in range(n):
		li.append(input())
	dict = {}
	for i in range(n):
		length = len(li[i])
		for j in range(length):
			if dict.get(li[i][j]) == None:
				dict[li[i][j]] = 1
			else:
				dict[li[i][j]] += 1
	c = list(dict.values())
	flag = True
	for i in c:
		if i % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


def check(l, mid, D):
	l.sort()
	curr = l[0] + mid
	for i in range(1, len(l)):
		if curr > l[i] + D:
			return 0
		elif curr < l[i]:
			curr = l[i] + mid
		else:
			curr += mid
	return 1

def binarysearch(l, start, end, d):
	mid = (start + end) / 2
	if end - start < 1e-06:
		return mid
	elif check(l, mid, d):
		return max(mid, binarysearch(l, mid + 10 ** (-6), end, d))
	else:
		return binarysearch(l, start, mid - 10 ** (-6), d)
for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = input()
		for j in s:
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
	f = 0
	for i in d:
		if d[i] % n != 0:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


t = int(input())
while t != 0:
	t = t - 1
	p = int(input())
	x = p
	arr = ''
	while p != 0:
		p = p - 1
		s = input()
		arr += s
	d = {}
	for i in range(len(arr)):
		if arr[i] not in d.keys():
			d[arr[i]] = 1
		else:
			d[arr[i]] += 1
	ans = 'YES'
	for i in d.keys():
		if d[i] % x != 0:
			ans = 'NO'
			break
	print(ans)


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	n = read_int()
	counter = dict()
	for i in range(n):
		s = input()
		for c in s:
			if c not in counter:
				counter[c] = 0
			counter[c] += 1
	ok = True
	for key in counter:
		if counter[key] % n != 0:
			ok = False
			break
	print('YES' if ok else 'NO')


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	d = {}
	for _ in range(n):
		s = stdin.readline().rstrip()
		for c in s:
			if c in d:
				d[c] += 1
			else:
				d[c] = 1
	res = 'YES'
	for v in d.values():
		if v % n != 0:
			res = 'NO'
			break
	print(res)


import math
import operator
for _ in range(int(input())):
	n = int(input())
	s = [input() for i in range(n)]
	c = [0 for i in range(26)]
	for i in s:
		for j in i:
			k = ord(j) - 97
			c[k] += 1
	b = True
	for i in c:
		if i % n != 0:
			b = False
			break
	if b == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = ''
	d = {}
	for _ in range(n):
		x = str(input())
		s += x
	for i in s:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	f = True
	for i in d:
		if d[i] % n != 0:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


alpha = 'qwertyuiopasdfghjklzxcvbnm'
for a0 in range(int(input())):
	n = int(input())
	total_length = 0
	counts = {c: 0 for c in alpha}
	for i in range(n):
		s = input().strip()
		for c in alpha:
			counts[c] += s.count(c)
		total_length += len(s)
	okay = total_length % n == 0
	for c in alpha:
		okay = okay and counts[c] % n == 0
	print('YES' if okay else 'NO')


def Solve():
	Strings = {}
	for c in Values:
		for i in range(len(c)):
			if c[i] in Strings:
				Strings[c[i]] += 1
			else:
				Strings[c[i]] = 1
	for c in Strings:
		if Strings[c] % n == 0:
			continue
		else:
			return 'NO'
	return 'YES'
TestCases = int(input(''))
Results = []
for c in range(TestCases):
	Values = []
	n = int(input(''))
	for c in range(n):
		v = input('')
		Values.append(v)
	Results.append(Solve())
for c in Results:
	print(c)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	d1 = defaultdict(int)
	for k in range(n):
		str1 = input()
		for i in str1:
			d1[i] += 1
	flag = 0
	for i in d1:
		if d1[i] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	s = []
	w = ''
	ct = []
	r = 1
	for i in range(n):
		w += str(input())
	if len(w) % n == 0:
		for i in set(w):
			if w.count(i) % n == 0:
				ct.append(w.count(i))
			else:
				print('NO')
				r = 0
				break
		if r == 1:
			print('YES')
	else:
		print('NO')


for test_case in range(int(input())):
	n = int(input())
	ans = ''
	for x in range(n):
		ans += input()
	freq = {}
	for x in ans:
		try:
			freq[x] += 1
		except KeyError:
			freq[x] = 1
	for x in freq.values():
		if x % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for ii in range(t):
	n = int(input())
	s = []
	for i in range(n):
		s.append(input())
	m = {}
	for i in s:
		for j in i:
			if j in m:
				m[j] += 1
			else:
				m[j] = 1
	ans = True
	for i in m:
		if m[i] % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = []
	for j in range(n):
		a = input()
		s.append(a)
	c = [0] * 26
	alp = 'abcdefghijklmnopqrstuvwxyz'
	for z in s:
		for y in z:
			diff = alp.find(y)
			c[diff] += 1
	for j in range(26):
		c[j] = c[j] % n
	ans = 'YES'
	for j in range(26):
		if c[j] != 0:
			ans = 'NO'
	print(ans)


def func(d, n):
	for letter in d:
		if d[letter] % n != 0:
			return False
	return True
t = int(input())
while t > 0:
	n = int(input())
	d = dict()
	for i in range(n):
		x = str(input().strip())
		for j in range(len(x)):
			if x[j] not in d:
				d[x[j]] = 1
			else:
				d[x[j]] += 1
	if func(d, n):
		print('YES')
	else:
		print('NO')
	t -= 1


def main(n):
	glob_count = {}
	for i in range(n):
		for ch in sorted(input()):
			if ch not in glob_count:
				glob_count[ch] = 1
			else:
				glob_count[ch] += 1
	for val in glob_count.values():
		if val % n != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(main(int(input())))


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	lst = []
	lst1 = []
	str1 = ''
	for i in range(0, n):
		str2 = input()
		str1 = str1 + str2
	for i in str1:
		if i not in lst:
			lst.append(i)
		lst1.append(i)
	p = 0
	for i in lst:
		if lst1.count(i) % n == 0:
			p = p + 1
	if p == len(lst):
		print('YES')
	else:
		print('NO')


def get(n):
	a = {}
	for _ in range(n):
		for i in input():
			if i in a:
				a[i] += 1
			else:
				a[i] = 1
	for i in a.values():
		if i % n != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	print(get(n))


t = int(input())
for zz in range(t):
	n = int(input())
	d = {}
	for yy in range(n):
		s = input()
		for i in s:
			d[i] = d.get(i, 0) + 1
	flag = True
	for i in d:
		if d[i] % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	p = set(s)
	l = []
	for i in p:
		l.append(s.count(i))
	c = 0
	for i in range(len(l)):
		if l[i] % n != 0:
			c += 1
			print('NO')
			break
	if c == 0:
		print('YES')


t = int(input())
while t:
	n = int(input())
	dict = {}
	flag = int(0)
	for i in range(n):
		s = input()
		for letter in s:
			if letter in dict.keys():
				dict[letter] += 1
			else:
				dict.update({letter: 1})
	for key in dict.keys():
		if dict[key] % n != 0:
			flag = 1
	if flag:
		print('NO')
	else:
		print('YES')
	t -= 1


tests = int(input())
for test in range(tests):
	dictionary = {}
	for c in range(26):
		dictionary[chr(97 + c)] = 0
	n = int(input())
	for i in range(n):
		s = input()
		for c in s:
			dictionary[c] = dictionary[c] + 1
	answer = 'YES'
	for (key, value) in dictionary.items():
		if value % n != 0:
			answer = 'NO'
	print(answer)


from collections import Counter
from collections import OrderedDict
from collections import defaultdict

def SOCountR(mylist):
	return OrderedDict(sorted(Counter(mylist).items(), reverse=True))

def SOCount(mylist):
	return OrderedDict(sorted(Counter(mylist).items()))

def fre_count(mylist):
	return Counter(mylist)
t = int(input())
for _ in range(t):
	n = int(input())
	li = []
	for i in range(n):
		for each in list(input()):
			li.append(each)
	fre = fre_count(li)
	for each in fre:
		if fre[each] % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import defaultdict
T = int(input())
for _ in range(T):
	n = int(input())
	arr = []
	d = defaultdict(int)
	for _ in range(n):
		arr.append(input())
	for i in arr:
		for j in i:
			d[j] += 1
	flag = 1
	for (i, j) in d.items():
		if j % n != 0:
			flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	freq = [0] * 26
	n = int(input())
	flag = 0
	for i in range(n):
		inp = input()
		for i in range(len(inp)):
			freq[ord(inp[i]) - ord('a')] += 1
	for i in range(len(freq)):
		if freq[i] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


import collections
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def juggle():
	for _ in range(int(input())):
		n = int(input())
		d = collections.defaultdict(int)
		for _ in range(n):
			arr = input()
			for char in arr:
				d[char] += 1
		valid = True
		for key in d:
			if d[key] % n != 0:
				print('NO')
				valid = False
				break
		if valid:
			print('YES')
juggle()


from collections import Counter

def ans(arr):
	cnt = Counter(arr)
	for i in cnt.values():
		if i % n:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	temp = ''
	for _ in range(n):
		temp += input()
	print(ans(temp))


from collections import defaultdict
t = int(input())
for _ in range(t):
	ok = 1
	n = int(input())
	L = []
	for i in range(n):
		L.append(str(input()))
	D = defaultdict(int)
	for i in range(n):
		A = list(L[i])
		for i in range(len(A)):
			D[A[i]] += 1
	for i in D:
		if D[i] % n != 0:
			ok = 0
	if ok == 1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	c = [0] * 26
	for i in range(n):
		s = input()
		for j in range(26):
			c[j] += s.count(chr(97 + j))
			c[j] %= n
	print(['YES', 'NO'][bool(sum(c))])


from sys import stdin
for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in range(n):
		s = stdin.readline().rstrip()
		for j in range(len(s)):
			if not d.get(s[j], 0):
				d[s[j]] = 0
			d[s[j]] += 1
	r = True
	for (i, j) in d.items():
		if j % n:
			r = False
			break
	if r:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
import sys
input = sys.stdin.readline
q = int(input())
ans = []
for _ in range(q):
	n = int(input())
	dic = defaultdict(int)
	for i in range(n):
		for x in input():
			dic[x] += 1
	flg = True
	for v in dic.values():
		if v % n != 0:
			flg = False
	ans.append('YES' if flg else 'NO')
for an in ans:
	print(an)


t = int(input())
for i in range(t):
	n = int(input())
	charCountMap = {}
	result = 'YES'
	for i in range(n):
		s = input()
		for c in s:
			if c not in charCountMap.keys():
				charCountMap[c] = 1
			else:
				charCountMap[c] += 1
	for key in charCountMap:
		if charCountMap[key] % n != 0:
			result = 'NO'
			break
	print(result)


for t in range(int(input())):
	a = int(input())
	d = {}
	for i in range(a):
		s1 = input()
		for j in s1:
			if j not in d:
				d[j] = 1
			else:
				d[j] += 1
	flag = 0
	for i in d.values():
		if i % a > 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	dct = {}
	for i in range(n):
		s = input()
		for j in s:
			dct[j] = dct.get(j, 0) + 1
	for i in dct:
		if dct[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	li = []
	for i in range(0, n):
		ele = input()
		li.append(ele)
	arr = []
	for i in range(0, 26):
		arr.append(0)
	for ele in li:
		for s in ele:
			o = ord(s)
			index = o % 97
			arr[index] += 1
	arr.sort()
	flag = True
	for i in range(25, -1, -1):
		if arr[i] % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')
	t = t - 1


for t in range(int(input())):
	n = int(input())
	s = ''
	for i in range(n):
		s += input()
	ans = 'YES'
	for i in range(97, 123):
		d = s.count(chr(i))
		if d % n:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	count = [0 for j in range(26)]
	for j in range(n):
		s = list(input())
		for k in range(len(s)):
			val = ord(s[k]) - 97
			count[val] += 1
	flag = 0
	for j in range(26):
		if count[j] % n != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	f = {}
	for i in range(n):
		s = input()
		for i in s:
			if i in f:
				f[i] += 1
			else:
				f[i] = 1
	fuck = 0
	for (i, j) in f.items():
		if f[i] % n != 0:
			fuck = 1
			break
	if fuck == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	fullword = ''
	for j in range(n):
		word = input()
		fullword += word
	size = len(fullword)
	unique_letter = ''
	for k in range(size):
		if fullword[k] not in unique_letter:
			unique_letter += fullword[k]
	s = len(unique_letter)
	c = 0
	for p in range(s):
		num = fullword.count(unique_letter[p])
		if num % n == 0:
			continue
		else:
			c += 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


def is_possible(n, list_string):
	length = 0
	for i in range(0, n):
		length += len(list_string[i])
	if length % n != 0:
		return 'NO'
	dict1 = {}
	for i in range(0, n):
		for j in range(0, len(list_string[i])):
			if list_string[i][j] not in dict1:
				dict1[list_string[i][j]] = 1
			else:
				dict1[list_string[i][j]] += 1
	for ele in dict1:
		if dict1[ele] % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(0, t):
	n = int(input())
	list_string = []
	for i in range(0, n):
		s = input()
		list_string.append(s)
	r = is_possible(n, list_string)
	print(r)


t = int(input())
while t > 0:
	n = int(input())
	arr = ['' for i in range(n)]
	for i in range(n):
		arr[i] = input()
	li = [0 for i in range(27)]
	for i in range(len(arr)):
		for j in range(len(arr[i])):
			li[ord(arr[i][j]) - 97] += 1
	ans = ''
	for i in range(len(li)):
		if li[i] % n != 0:
			ans = 'NO'
			break
		ans = 'YES'
	print(ans)
	t -= 1


import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from itertools import permutations, product

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def inc(d, c):
	d[c] = d[c] + 1 if c in d else 1

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j):
	return 0 <= i < n and 0 <= j < n

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
while t > 0:
	t -= 1
	n = fi()
	d = [0] * 27
	for i in range(n):
		s = si()
		for j in range(len(s)):
			d[bo(s[j])] += 1
	flag = 0
	for i in range(26):
		if d[i] % n:
			flag = 1
			break
	print('YES' if flag == 0 else 'NO')


from collections import Counter
cases = int(input())
for case in range(cases):
	n_lines = int(input())
	count = Counter()
	for n_line in range(n_lines):
		line = input()
		count += Counter(line)
	for i in count.values():
		if i % n_lines != 0:
			print('NO')
			break
	else:
		print('YES')


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	n = int(input())
	freq_Dic = defaultdict(int)
	for i in range(n):
		st = input()
		for val in st:
			freq_Dic[val] += 1
	for (key, val) in freq_Dic.items():
		if val % n:
			return 'NO'
	return 'YES'

def main():
	print(solve())
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


from collections import Counter

def solve(n, array_s):
	count = 0
	if count % n != 0:
		return 'NO'
	d = Counter()
	for (i, s) in enumerate(array_s):
		count = count + len(s)
		d.update(s)
	for (key, val) in d.items():
		if val % n != 0:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for j in range(n):
		a.append(input())
	print(solve(n, a))


t = int(input())
c = []
for i in range(t):
	n = int(input())
	d = {}
	for j in range(n):
		x = input()
		for k in x:
			if k in d:
				d[k] += 1
			else:
				d[k] = 1
	flag = 0
	for j in d:
		if d[j] % n != 0:
			flag = 1
			break
	if flag == 0:
		c.append('YES')
	else:
		c.append('NO')
for k in c:
	print(k)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = ''
	for _ in range(n):
		s += input()
	flag = True
	for (k, v) in Counter(s).most_common():
		if v % n != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = ''
	flag = 1
	for i in range(n):
		s = input()
		a = a + s
	p = Counter(a)
	x = p.values()
	for i in x:
		if i % n != 0:
			flag = 0
	if flag == 0:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	no = False
	X = int(input())
	L = []
	d = {}
	for i in range(X):
		s = input().strip('\r')
		for i in range(len(s)):
			if s[i] in d:
				d[s[i]] += 1
			else:
				d[s[i]] = 1
	for key in d:
		if d[key] % X != 0:
			print('NO')
			no = True
			break
	if no == False:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = [0] * 26
	for i in range(0, n):
		s = input().strip()
		for i in s:
			b = ord(i) - 97
			l[b] += 1
	fg = 0
	for i in range(0, 26):
		if l[i] % n != 0:
			fg = 1
			break
	if fg == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	mp = [0 for i in range(40)]
	for i in range(n):
		s = input()
		for j in s:
			mp[ord(j) - ord('a')] += 1
	ans = 'YES'
	for i in range(40):
		if mp[i] % n != 0:
			ans = 'NO'
			break
	print(ans)


t = int(input())
natija = []
for i in range(t):
	n = int(input())
	harflar_soni = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
	for j in range(n):
		s = input()
		for c in s:
			harflar_soni[ord(c) - 97] += 1
	bajarilishi = True
	for j in range(26):
		if harflar_soni[j] % n != 0:
			bajarilishi = False
			break
	if bajarilishi:
		natija.append('YES')
	else:
		natija.append('NO')
for i in range(t):
	print(natija[i])


for i in range(int(input())):
	s = ''
	b = True
	n = int(input())
	for i in range(n):
		s += input()
	for i in s:
		if s.count(i) % n != 0:
			b = False
	if b == False:
		print('NO')
	else:
		print('YES')


def jug(ans, m):
	flag = False
	for i in range(len(ans) - 1):
		if ans[i] != ans[i + 1]:
			flag = True
	if flag == False:
		return 'YES'
	else:
		for i in m:
			if m.count(i) % t != 0:
				return 'NO'
		return 'YES'
n = int(input())
for i in range(n):
	t = int(input())
	ans = []
	m = ''
	for j in range(t):
		s = input()
		m += s
		s = sorted(s)
		ans.append(s)
	print(jug(ans, m))


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	dic = {}
	flg = False
	for i in range(n):
		str = input()
		temp_dic = dict(Counter(str))
		for j in temp_dic.keys():
			try:
				dic[j] += temp_dic[j]
			except KeyError:
				dic.update({j: temp_dic[j]})
	for k in dic.values():
		if int(k) % n != 0:
			flg = True
	if flg:
		print('NO')
	else:
		print('YES')


T = int(input())
for i in range(T):
	N = int(input())
	(S, C) = ([], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
	for j in range(N):
		K = input()
		S.append(K)
		for k in range(len(K)):
			C[ord(K[k]) - 97] += 1
	Possible = True
	for j in range(26):
		if C[j] % N != 0:
			Possible = False
			break
	if Possible == True:
		print('YES')
	else:
		print('NO')


from collections import Counter
t = int(input())
for _ in range(t):
	strings_num = int(input())
	counter = Counter()
	for _ in range(strings_num):
		counter += Counter(input())
	success = True
	for count in counter.values():
		if count % strings_num != 0:
			success = False
	print('YES' if success else 'NO')


for i in range(int(input())):
	n = int(input())
	su = 0
	to = ''
	for i in range(n):
		s = input()
		to = to + s
		a = len(s)
		su = su + a
	if su % n == 0:
		tos = set(to)
		f = 0
		for i in tos:
			c = to.count(i)
			if c % n != 0:
				f = 1
				break
		if f == 1:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		s = input()
		l += list(s)
	h = set(l)
	p = 0
	for i in h:
		if l.count(i) % n == 0:
			continue
		else:
			p = 1
			print('NO')
			break
	if p == 0:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = []
	exec(n * 'a=input();l.append(a);')
	l = ''.join(l)
	l = Counter(l)
	for i in l:
		if l[i] % n != 0:
			print('NO')
			break
	else:
		print('YES')


from collections import defaultdict, Counter

def modinv(n, p):
	return pow(n, p - 2, p)

def main():
	for case in range(int(input())):
		n = int(input())
		d = defaultdict(lambda : 0)
		for i in range(n):
			s = input()
			for c in s:
				d[c] += 1
		d = dict(d).values()
		not_possible = False
		for x in d:
			if x % n != 0:
				not_possible = True
				break
		if not_possible:
			print('NO')
		else:
			print('YES')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def isit(strings):
	mydict = {}
	for i in range(ord('a'), ord('z') + 1):
		mydict[chr(i)] = 0
	for string in strings:
		for i in string:
			mydict[i] += 1
	for i in range(ord('a'), ord('z') + 1):
		if mydict[chr(i)] % len(strings) != 0:
			print('NO')
			return
	print('YES')
num = int(input())
for i in range(num):
	a = int(input())
	strings = []
	for k in range(a):
		str = input()
		strings.append(str)
	isit(strings)


from math import gcd
from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	d = defaultdict(int)
	for i in range(n):
		temp = input()
		for i in temp:
			d[i] += 1
	flag = False
	for i in d.keys():
		if d[i] % n != 0:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')


from collections import Counter
for t in range(int(input())):
	n = int(input())
	l = []
	s = ''
	for i in range(n):
		a = input()
		s += a
	l = list(s)
	cnt = Counter(l)
	count = 0
	for i in cnt:
		if cnt[i] % n != 0:
			count += 1
	if count > 0:
		print('NO')
	else:
		print('YES')


n = int(input())
while n:
	l = int(input())
	tmp = l
	d = {}
	x = ''
	while l:
		s = input()
		x += s
		l -= 1
	for letter in x:
		if letter in d:
			d[letter] += 1
		else:
			d[letter] = 1
	flag = False
	for val in d.values():
		if val % tmp != 0:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')
	n -= 1


t = int(input())
for i in range(t):
	n = int(input())
	s = []
	d = {}
	for i in range(n):
		s = list(input())
		for i in s:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	c = True
	for (i, j) in d.items():
		if j % n != 0:
			c = False
			break
	if c == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	t = 0
	S = ''
	for j in range(n):
		S += input()
	S = list(S)
	for k in set(S):
		m = S.count(k)
		if m == n or m % n == 0:
			t += 1
	if t == len(set(S)):
		print('YES')
	else:
		print('NO')


import sys

def get_int():
	return int(input())

def get_n_int():
	return list(map(int, input().split()))

def get_str():
	return int(input())

def get_n_str():
	return input().split()
t = get_int()
for i in range(t):
	n = get_int()
	chars = dict()
	ans = True
	for j in range(n):
		s = input()
		for ch in s:
			if ch not in chars:
				chars[ch] = 0
			chars[ch] += 1
	for num in chars.values():
		if num % n != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	str = ''
	n = int(input())
	for j in range(n):
		s = input()
		str += s
	dict_str = {}
	for key in str:
		if key not in dict_str.keys():
			dict_str[key] = 1
		else:
			dict_str[key] += 1
	flag = True
	for key in dict_str:
		if dict_str[key] % n != 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	b = {}
	for i in range(n):
		a = input()
		for j in range(len(a)):
			if a[j] not in b.keys():
				b[a[j]] = 1
			else:
				b[a[j]] += 1
	e = 0
	for i in b:
		if b[i] % n != 0:
			e = 1
			break
	if e == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter
for i in range(int(input())):
	l = []
	n = int(input())
	for j in range(n):
		l.extend(list(input()))
	c = Counter(l)
	l = list(c.values())
	l = list(map(lambda x: x % n == 0, l))
	if all(l):
		print('YES')
	else:
		print('NO')


import sys
import math

def readStr():
	return sys.stdin.readline().rstrip()

def readInts():
	return list(map(int, readStr().split(' ')))

def readLatins():
	return [ord(c) - 97 for c in readStr()]

def main(n, s):
	c = {}
	for si in s:
		for cij in si:
			if cij not in c:
				c[cij] = 0
			c[cij] += 1
	for cij in c:
		if c[cij] % n != 0:
			return False
	return True
(t,) = readInts()
for _ in range(t):
	(n,) = readInts()
	s = []
	for i in range(n):
		si = readStr()
		s.append(si)
	f = main(n, s)
	print('YES' if f else 'NO')


for _ in range(int(input())):
	n = int(input())
	dic = {}
	for i in range(n):
		s = input().strip()
		for c in s:
			dic[c] = dic.get(c, 0) + 1
	for k in dic:
		if dic[k] % n != 0:
			print('NO')
			break
	else:
		print('YES')