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: interview

Starter code:

Solutions:
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')

alph=__import__('string').ascii_lowercase
for _ in range(int(input())):
    n=int(input())
    g={i:0for 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])

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()
"""
60, 61
"""
"""
"""

__starting_point()

import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
letters = ascii_letters
input = stdin.readline
#print = stdout.write

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 list(have.items()):
        if i[1] % n:
            can = False
            break
    print('YES' if can else 'NO')


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())
    d=dict()
    for i in range (n):
        s=input()
        for j in s:
            if j in d:
                d[j]+=1
            else:
                d[j]=1
    c=1
    for i in d:
        if d[i]%n!=0:
            c=0
            break
    if c==1:
        print("YES")
    else:
        print("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')


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 list(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 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())
    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')

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 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)


import sys
# sys.stdin = open('input.txt', 'r') 
# sys.stdout = open('output.txt', 'w')
 
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())
# T = 1

for _ in range(T):
    n = int(stdin.readline())
    # n,d = list(map(int,stdin.readline().split()))
    # a = list(map(int,stdin.readline().split()))
    # q = int(stdin.readline())
    # a = list(map(int,stdin.readline().split()))
    # b = list(map(int,stdin.readline().split()))
    # s = stdin.readline().strip('\n')
    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")

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()

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")