import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

public class Cf131 implements Runnable
{
    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt()
        {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do
            {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }

        public double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception
    {
        new Thread(null, new Cf131(),"Main",1<<27).start();
    }

    static class Pair{
        int nod;
        int ucn;

        Pair(int nod,int ucn){
            this.nod=nod;
            this.ucn=ucn;

        }

        public static Comparator<Pair> wc = new Comparator<Pair>(){
            public int compare(Pair e1,Pair e2){

                //reverse order
                if(e1.ucn < e2.ucn)
                    return 1;  // 1 for swaping.
                else if (e1.ucn > e2.ucn)
                    return -1;
                else{
                    // if(e1.siz>e2.siz)
                    //     return 1;
                    // else
                    //     return -1;
                    return 0;
                }
            }
        };
    }

    public static long gcd(long a,long b){
        if(b==0)return a;
        else return gcd(b,a%b);
    }

    ////recursive BFS
    public static int bfsr(int s,ArrayList<Integer>[] a,int[] dist,boolean[] b,int[] pre){
        b[s]=true;
        int p = 0;
        int t = a[s].size();
        for(int i=0;i<t;i++){
            int x = a[s].get(i);
            if(!b[x]){
                dist[x] = dist[s] + 1;
                p+= (bfsr(x,a,dist,b,pre)+1);
            }
        }
        pre[s] = p;
        return p;
    }

//// iterative BFS
    public static int bfs(int s,ArrayList<Integer>[] a,int[] dist,boolean[] b,PrintWriter w){
        b[s]=true;
        int siz = 0;

        Queue<Integer> q = new LinkedList<>();
        q.add(s);
        while(q.size()!=0){
            int i=q.poll();
            Iterator<Integer> it = a[i].listIterator();
            int z=0;
            while(it.hasNext()){
                z=it.next();
                if(!b[z]){
                    b[z]=true;
                    dist[z] = dist[i] + 1;
                    siz++;
                    q.add(z);
                }
            }

        }
        return siz;
    }

//////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////

    public void run()
    {
        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int defaultValue=0;

        // int tc = sc.nextInt();

        // while(tc-->0){

            int n = sc.nextInt();
            int[] a = new int[n];
            int[] h = new int[40000];
            PriorityQueue<Pair> pq = new PriorityQueue<Pair>(Pair.wc);

            for(int i=0;i<n;i++){
                a[i] = sc.nextInt();
            }
            Arrays.sort(a);

            for(int i=0;i<n;i++){
                double r = Math.sqrt(a[i]);
                double x = Math.ceil(r);
                if((r-x)>0.5){
                    h[(int)(double)(x+1)]++;

                }
                else{
                    h[(int)(double)(x)]++;

                }
            }

            int pre =0;
            long ans = Long.MAX_VALUE;
            for(int i=0;i<40000;i++){
                pq.add(new Pair(i,h[i]));
            }
            for(int i=0;i<40000;i++){
                Pair x = pq.poll();
                //w.print("*"+x.nod);
                if(x.ucn<pre){
                    break;
                }
                else{
                    long y = 0;
                    for(int j=0;j<n;j++){
                        y+=Math.abs( Math.pow(x.nod,j) - (a[j]));
                    }
                    ans = Math.min(ans,y);
                }
                //w.println(" "+ans);
                pre = x.ucn;
            }
            w.println(ans);

       //}
        w.flush();
        w.close();
    }

}


import java.util.*;

public class Main{
	// public static
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0){
			int n=sc.nextInt();
			String[] arr= new String[n];
			for(int i=0;i<n;i++){
				arr[i]=sc.next();
			}
			HashMap<Character,Integer> map= new HashMap<Character,Integer>();
			for(String str:arr){
				char[] s= str.toCharArray();
				for(Character x:s){
					if(map.containsKey(x)){
						map.put(x,map.get(x)+1);
					}else{
						map.put(x,1);
					}
				}
			}
			int flag=0;
			for(Character c:map.keySet()){
				if(map.get(c)%n!=0){
					System.out.println("NO");
					flag=1;
					break;
				}
			}
			if(flag==0)
			System.out.println("YES");
		}
	}
}


import java.util.*;

public class Main{
	// public static
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0){
			int n=sc.nextInt();
			String[] arr= new String[n];
			for(int i=0;i<n;i++){
				arr[i]=sc.next();
			}
			HashMap<Character,Integer> map= new HashMap<Character,Integer>();
			for(String str:arr){
				char[] s= str.toCharArray();
				for(Character x:s){
					if(map.containsKey(x)){
						map.put(x,map.get(x)+1);
					}else{
						map.put(x,1);
					}
				}
			}
			int flag=0;
			for(Character c:map.keySet()){
				if(map.get(c)%2!=0){
					System.out.println("NO");
					flag=1;
					break;
				}
			}
			if(flag==0)
			System.out.println("YES");
		}
	}
}


import java.util.Scanner;

public class juggling {
    public static void main(String[] args) {
        int t;
        int[] arr = new int[26];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = 0;
        }

        Scanner scan = new Scanner(System.in);
        t = scan.nextInt();
        while (t--!=0) {
            int n = scan.nextInt();

            for (int i = 0; i < n; i++) {
                String str = scan.next();
                for (int j = 0; j < str.length();j++) {
                    int x = str.charAt(j);
                    arr[x-97]+=1;
                }
            }
            boolean g = true;
            for (int j = 0; j < arr.length; j++) {
                if (arr[j]%n!=0) {
                    g = false;
                    break;
                }
            }
            if (g) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}


import java.util.Scanner;

public class juggling {
    public static void main(String[] args) {
        int t;

        Scanner scan = new Scanner(System.in);
        t = scan.nextInt();
        while (t--!=0) {
            int n = scan.nextInt();

            int[] arr = new int[26];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = 0;
            }
            for (int i = 0; i < n; i++) {
                String str = scan.next();
                for (int j = 0; j < str.length();j++) {
                    int x = str.charAt(j);
                    arr[x-97]+=1;
                }
            }
            boolean g = true;
            for (int j = 0; j < arr.length; j++) {
                if (arr[j]%n!=0) {
                    g = false;
                    break;
                }
            }
            if (g) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}


//package cp;

import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class CF {

    static FastReader sc = new FastReader();

    public static void main(String[] args) {
        int t = sc.nextInt();
        while (t-- > 0) {
            solve();
        }
    	//solve();
    }

    //@SuppressWarnings("unlikely-arg-type")
	static void solve() {
    	int n = sc.nextInt();
    	String str = "";
    	while(n-- >0) {
    		String s = sc.next();
    		str+=s;
    	}
    	//System.out.println(str);
    	Map<Character,Integer> map = new HashMap<>();
    	for(int i=0 ; i<str.length() ; i++) {
    		if(map.containsKey(str.charAt(i))) {
    			map.put(str.charAt(i), map.get(str.charAt(i))+1);
    		}
    		else {
    			map.put(str.charAt(i), 1);
    		}
    	}
    	boolean flag = false;
    	for(Map.Entry<Character, Integer> entry : map.entrySet()) {
    		if(entry.getValue() % 2 == 0) {
    			flag = true;
    		}
    		else {
    			flag = false;
    			break;
    		}
    	}
    	if(flag == true) {
    		System.out.println("YES");
    	}
    	else {
    		System.out.println("NO");
    	}
    }
    //fast input reader
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


//package cp;

import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class CF {

    static FastReader sc = new FastReader();

    public static void main(String[] args) {
        int t = sc.nextInt();
        while (t-- > 0) {
            solve();
        }
    	//solve();
    }

    //@SuppressWarnings("unlikely-arg-type")
	static void solve() {
    	int n = sc.nextInt();
    	int temp = n;
    	String str = "";
    	while(n-- >0) {
    		String s = sc.next();
    		str+=s;
    	}
    	//System.out.println(str);
    	Map<Character,Integer> map = new HashMap<>();
    	for(int i=0 ; i<str.length() ; i++) {
    		if(map.containsKey(str.charAt(i))) {
    			map.put(str.charAt(i), map.get(str.charAt(i))+1);
    		}
    		else {
    			map.put(str.charAt(i), 1);
    		}
    	}
    	boolean flag = false;
    	for(Map.Entry<Character, Integer> entry : map.entrySet()) {
    		if(entry.getValue() % temp== 0) {
    			flag = true;
    		}
    		else {
    			flag = false;
    			break;
    		}
    	}
    	if(flag == true) {
    		System.out.println("YES");
    	}
    	else {
    		System.out.println("NO");
    	}
    }
    //fast input reader
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


//package cp;

import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class CF {

    static FastReader sc = new FastReader();

    public static void main(String[] args) {
        int t = sc.nextInt();
        while (t-- > 0) {
            solve();
        }
    	//solve();
    }
	static void solve() {
    	int n = sc.nextInt();
    	int temp = n;
    	Map<Character,Integer> map = new HashMap<>();
    	while(n-- >0) {
    		String str = sc.next();
    		for(int i=0 ; i<str.length() ; i++) {
    			if(map.containsKey(str.charAt(i))) {
    				map.put(str.charAt(i), map.get(str.charAt(i))+1);
    			}
    			else {
    				map.put(str.charAt(i), 1);
    			}
    		}
    	}
    	boolean flag = true;
    	for(Map.Entry<Character, Integer> entry : map.entrySet()) {
    		if(entry.getValue() % temp != 0) {
    			flag = false;
    			break;
    		}
    	}
    	if(flag==false) {
    		System.out.println("no");
    	}
    	else {
    		System.out.println("yes");
    	}
    }
    //fast input reader
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.awt.dnd.InvalidDnDOperationException;
import java.io.*;
import java.lang.reflect.Array;
import java.nio.charset.CharsetEncoder;
import java.util.*;

public class Main {
    private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    private static final boolean OFFLINE_WITHOUT_FILES = false;

    void solve() throws IOException {
        int t=readInt();
        while (0<t--){
            int n=readInt();
            int [] countOfAlph=new int[27];
            for (int i=0;i<n;++i){
                String inp=readLine();
                for (int j=0;j<inp.length();++j){
                    ++countOfAlph[Character.getNumericValue(inp.charAt(j))];
                }
            }
            String answer="YES";
            for (int el:countOfAlph){
                if (el%n!=0){
                    answer="NO";
                    break;
                }
            }
            out.println(answer);
        }
    }

    public static void main(String[] args) {
        new Main();
    }

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;

    Main() {
        try {
            long timeStart = System.currentTimeMillis();
            if (ONLINE_JUDGE || OFFLINE_WITHOUT_FILES) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                in = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            }

            tok = new StringTokenizer("");
            solve();
            out.close();
            long timeEnd = System.currentTimeMillis();
            System.err.println("time = " + (timeEnd - timeStart) + " compiled");
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    String readLine() throws IOException {
        return in.readLine();
    }

    String delimiter = " ";

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            String nextLine = readLine();
            if (nextLine == null)
                return null;
            tok = new StringTokenizer(nextLine);
        }
        return tok.nextToken(delimiter);
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    int[] sortArrayInt(int[] a) {
        Integer[] arr = new Integer[a.length];
        for (int i = 0; i < a.length; i++) {
            arr[i] = a[i];
        }
        Arrays.sort(arr);
        for (int i = 0; i < a.length; i++) {
            a[i] = arr[i];
        }
        return a;
    }

    void sortArrayLong(long[] a) {
        Long[] arr = new Long[a.length];
        for (int i = 0; i < a.length; i++) {
            arr[i] = a[i];
        }
        Arrays.sort(arr);
        for (int i = 0; i < a.length; i++) {
            a[i] = arr[i];
        }
    }
}


import java.awt.dnd.InvalidDnDOperationException;
import java.io.*;
import java.lang.reflect.Array;
import java.nio.charset.CharsetEncoder;
import java.util.*;

public class Main {
    private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    private static final boolean OFFLINE_WITHOUT_FILES = false;

    void solve() throws IOException {
        int t=readInt();
        while (0<t--){
            int n=readInt();
            int [] countOfAlph=new int[50];
            for (int i=0;i<n;++i){
                String inp=readLine();
                for (int j=0;j<inp.length();++j){
                    ++countOfAlph[Character.getNumericValue(inp.charAt(j))];
                }
            }
            String answer="YES";
            for (int el:countOfAlph){
                if (el%n!=0){
                    answer="NO";
                    break;
                }
            }
            out.println(answer);
        }
    }

    public static void main(String[] args) {
        new Main();
    }

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;

    Main() {
        try {
            long timeStart = System.currentTimeMillis();
            if (ONLINE_JUDGE || OFFLINE_WITHOUT_FILES) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                in = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            }

            tok = new StringTokenizer("");
            solve();
            out.close();
            long timeEnd = System.currentTimeMillis();
            System.err.println("time = " + (timeEnd - timeStart) + " compiled");
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    String readLine() throws IOException {
        return in.readLine();
    }

    String delimiter = " ";

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            String nextLine = readLine();
            if (nextLine == null)
                return null;
            tok = new StringTokenizer(nextLine);
        }
        return tok.nextToken(delimiter);
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    int[] sortArrayInt(int[] a) {
        Integer[] arr = new Integer[a.length];
        for (int i = 0; i < a.length; i++) {
            arr[i] = a[i];
        }
        Arrays.sort(arr);
        for (int i = 0; i < a.length; i++) {
            a[i] = arr[i];
        }
        return a;
    }

    void sortArrayLong(long[] a) {
        Long[] arr = new Long[a.length];
        for (int i = 0; i < a.length; i++) {
            arr[i] = a[i];
        }
        Arrays.sort(arr);
        for (int i = 0; i < a.length; i++) {
            a[i] = arr[i];
        }
    }
}


import java.io.*;
import java.util.*;

public class ques1
{
	public static void main(String[] args)throws Exception{ new ques1().run();}
	long mod=1000000000+7;

	void solve() throws Exception
	{
		for(int ii=ni();ii>0;ii--)
		{
			int N=ni();
			String s[]=new String[N];
			long c[]=new long[26];
			for (int i = 0; i < N; i++) {
				s[i]=ns();
				for (int j = 0; j < s[i].length(); j++) {
					c[s[i].charAt(j)-'a']++;
				}
			}
			int flag=0;
			for(int i=0;i<26;i++)
			{
				if(c[i]%N!=0)
					flag=1;
			}
			if(flag==0)
				out.println("Yes");
			else
				out.println("No");

		}
	}

	/*IMPLEMENTATION BY AMAN KOTIYAL, FAST INPUT OUTPUT & METHODS BELOW*/

	private byte[] buf=new byte[1024];
	private int index;
	private InputStream in;
	private int total;
	private SpaceCharFilter filter;
	PrintWriter out;

	int gcd(int a, int b)
	{
		if (a == 0)
			return b;
		return gcd(b%a, a);
	}
	/* for (1/a)%mod = ( a^(mod-2) )%mod  ----> use expo to calc -->(a^(mod-2)) */
	long expo(long p,long q)  /*  (p^q)%mod   */
	{
		long z = 1;
		while (q>0) {
			if (q%2 == 1) {
				z = (z * p)%mod;
			}
			p = (p*p)%mod;
			q >>= 1;
		}
		return z;
	}
	void run()throws Exception
	{
		in=System.in; out = new PrintWriter(System.out);
		solve();
		out.flush();
	}
	private int scan()throws IOException
	{
		if(total<0)
			throw new InputMismatchException();
		if(index>=total)
		{
			index=0;
			total=in.read(buf);
			if(total<=0)
				return -1;
		}
		return buf[index++];
	}
	private int ni() throws IOException
	{
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = scan();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = scan();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	private long nl() throws IOException
	{
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = scan()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = scan();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = scan();
		}
	}
	private double nd() throws IOException{
		return Double.parseDouble(ns());
	}
	private String ns() throws IOException {
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		StringBuilder res = new StringBuilder();
		do {
			if (Character.isValidCodePoint(c))
				res.appendCodePoint(c);
			c = scan();
		} while (!isSpaceChar(c));
		return res.toString();
	}
	private String nss() throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		return br.readLine();
	}
	private char nc() throws IOException
	{
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		return (char) c;
	}
	private boolean isWhiteSpace(int n)
	{
		if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
			return true;
		return false;
	}
	private boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhiteSpace(c);
	}
	private interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


import java.io.*;
import java.util.*;

public class ques1
{
	public static void main(String[] args)throws Exception{ new ques1().run();}
	long mod=1000000000+7;

	void solve() throws Exception
	{
		for(int ii=ni();ii>0;ii--)
		{
			int N=ni();
			String s[]=new String[N];
			long c[]=new long[26];
			for (int i = 0; i < N; i++) {
				s[i]=ns();
				for (int j = 0; j < s[i].length(); j++) {
					c[s[i].charAt(j)-'a']++;
				}
			}
			int flag=0;
			for(int i=0;i<26;i++)
			{
				if(c[i]%N==1)
					flag=1;
			}
			if(flag==0)
				out.println("Yes");
			else
				out.println("No");

		}
	}

	/*IMPLEMENTATION BY AMAN KOTIYAL, FAST INPUT OUTPUT & METHODS BELOW*/

	private byte[] buf=new byte[1024];
	private int index;
	private InputStream in;
	private int total;
	private SpaceCharFilter filter;
	PrintWriter out;

	int gcd(int a, int b)
	{
		if (a == 0)
			return b;
		return gcd(b%a, a);
	}
	/* for (1/a)%mod = ( a^(mod-2) )%mod  ----> use expo to calc -->(a^(mod-2)) */
	long expo(long p,long q)  /*  (p^q)%mod   */
	{
		long z = 1;
		while (q>0) {
			if (q%2 == 1) {
				z = (z * p)%mod;
			}
			p = (p*p)%mod;
			q >>= 1;
		}
		return z;
	}
	void run()throws Exception
	{
		in=System.in; out = new PrintWriter(System.out);
		solve();
		out.flush();
	}
	private int scan()throws IOException
	{
		if(total<0)
			throw new InputMismatchException();
		if(index>=total)
		{
			index=0;
			total=in.read(buf);
			if(total<=0)
				return -1;
		}
		return buf[index++];
	}
	private int ni() throws IOException
	{
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = scan();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = scan();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	private long nl() throws IOException
	{
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = scan()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = scan();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = scan();
		}
	}
	private double nd() throws IOException{
		return Double.parseDouble(ns());
	}
	private String ns() throws IOException {
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		StringBuilder res = new StringBuilder();
		do {
			if (Character.isValidCodePoint(c))
				res.appendCodePoint(c);
			c = scan();
		} while (!isSpaceChar(c));
		return res.toString();
	}
	private String nss() throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		return br.readLine();
	}
	private char nc() throws IOException
	{
		int c = scan();
		while (isSpaceChar(c))
			c = scan();
		return (char) c;
	}
	private boolean isWhiteSpace(int n)
	{
		if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
			return true;
		return false;
	}
	private boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhiteSpace(c);
	}
	private interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class Test
{
    public static void main(String[] args)
    {
        Scanner scan=new Scanner(System.in);
        int t=scan.nextInt();
        while(t-->0)
        {
            int n=scan.nextInt();

            int[] arr = new int[26];

            for(int i=0;i<n;i++)
            {
                String st=scan.next();
                for(int j=0;j<st.length();++j)
                    arr[st.charAt(j)-'a']++;
            }
            int i;
            for(i=0;i<26;i++)
                if(arr[i]%n!=0)
                    break;
            if(i==26)
                System.out.println("YES");
            else
                System.out.println("NO");
        }

    }
}


import java.util.*;
import java.io.*;
import java.math.*;

public class CP{

  public static OutputStream out=new BufferedOutputStream(System.out);
  static Scanner sc=new Scanner(System.in);
  static long mod=1000000007l;
  static int INF=10000000;
  static int[] rr=new int[]{1, 0, -1, 0};                                 //rook row move
  static int[] rc=new int[]{0, 1, 0, -1};                                 //rook col move

  //nl-->neew line; //l-->line;  //arp-->array print;  //arpnl-->array print new line
  public static void nl(Object o) throws IOException{out.write((o+"\n").getBytes()); }
  public static void l(Object o) throws IOException{out.write((o+"").getBytes());}
  public static void arp(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+" ").getBytes()); out.write(("\n").getBytes());}
  public static void arpnl(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+"\n").getBytes());}
  public static void scanl(long[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextLong();}
  public static void scani(int[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextInt();}
  public static void scan2D(int[][] a,int n,int m) {for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=sc.nextInt();}
  //
  static long cnt;
  static TreeSet<Integer> ans;
  static int n,d;
  static int[][] dp;
  static HashMap<Pair,Boolean> arrl;
  static Stack<Integer> stk;
  static Queue<Integer> queue;
  static HashSet<Integer> mtrnode;
  static ArrayList<Pair> arrlans;
  static int[] ff;

  public static void main(String[] args) throws IOException{
    long sttm=System.currentTimeMillis();
    long mod=1000000007l;

    int t=sc.nextInt();
    while(t-->0){
        int n=sc.nextInt();
        int[] cnt=new int[26];
        for(int i=0;i<n;i++){
            String s=sc.next();
            for(char c:s.toCharArray()){
                cnt[c-'a']++;
            }
        }
        boolean con=true;
        for(int i=0;i<26;i++){
            if(cnt[i]%n!=0){
                con=false;
                break;
            }
        }
        if(con) nl("YES");
        else nl("NO");
    }

    out.flush();
  }
}

class Pair{
  int x; int y;
  Pair(int x,int y){
    this.x=x;
    this.y=y;
  }
}


import java.util.*;
import java.io.*;
import java.math.*;

public class CP{

  public static OutputStream out=new BufferedOutputStream(System.out);
  static Scanner sc=new Scanner(System.in);
  static long mod=1000000007l;
  static int INF=10000000;
  static int[] rr=new int[]{1, 0, -1, 0};                                 //rook row move
  static int[] rc=new int[]{0, 1, 0, -1};                                 //rook col move

  //nl-->neew line; //l-->line;  //arp-->array print;  //arpnl-->array print new line
  public static void nl(Object o) throws IOException{out.write((o+"\n").getBytes()); }
  public static void l(Object o) throws IOException{out.write((o+"").getBytes());}
  public static void arp(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+" ").getBytes()); out.write(("\n").getBytes());}
  public static void arpnl(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+"\n").getBytes());}
  public static void scanl(long[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextLong();}
  public static void scani(int[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextInt();}
  public static void scan2D(int[][] a,int n,int m) {for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=sc.nextInt();}
  //
  static long cnt;
  static TreeSet<Integer> ans;
  static int n,d;
  static int[][] dp;
  static HashMap<Pair,Boolean> arrl;
  static Stack<Integer> stk;
  static Queue<Integer> queue;
  static HashSet<Integer> mtrnode;
  static ArrayList<Pair> arrlans;
  static int[] ff;

  public static void main(String[] args) throws IOException{
    long sttm=System.currentTimeMillis();
    long mod=1000000007l;

    int t=sc.nextInt();
    while(t-->0){
        int n=sc.nextInt();
        int[][] cnt=new int[n][26];
        for(int i=0;i<n;i++){
            String s=sc.next();
            for(char c:s.toCharArray()){
                cnt[i][c-'a']++;
            }
        }
        boolean con=true;
        aa: for(int i=1;i<n;i++){
            for(int j=0;j<26;j++){
                if(cnt[0][j]!=cnt[i][j]){
                    con=false;
                    break aa:
                }
            }
        }
        if(con) nl("YES");
        else nl("NO");
    }

    out.flush();
  }
}

class Pair{
  int x; int y;
  Pair(int x,int y){
    this.x=x;
    this.y=y;
  }
}


import java.util.*;
import java.io.*;
import java.math.*;

public class CP{

  public static OutputStream out=new BufferedOutputStream(System.out);
  static Scanner sc=new Scanner(System.in);
  static long mod=1000000007l;
  static int INF=10000000;
  static int[] rr=new int[]{1, 0, -1, 0};                                 //rook row move
  static int[] rc=new int[]{0, 1, 0, -1};                                 //rook col move

  //nl-->neew line; //l-->line;  //arp-->array print;  //arpnl-->array print new line
  public static void nl(Object o) throws IOException{out.write((o+"\n").getBytes()); }
  public static void l(Object o) throws IOException{out.write((o+"").getBytes());}
  public static void arp(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+" ").getBytes()); out.write(("\n").getBytes());}
  public static void arpnl(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+"\n").getBytes());}
  public static void scanl(long[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextLong();}
  public static void scani(int[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextInt();}
  public static void scan2D(int[][] a,int n,int m) {for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=sc.nextInt();}
  //
  static long cnt;
  static TreeSet<Integer> ans;
  static int n,d;
  static int[][] dp;
  static HashMap<Pair,Boolean> arrl;
  static Stack<Integer> stk;
  static Queue<Integer> queue;
  static HashSet<Integer> mtrnode;
  static ArrayList<Pair> arrlans;
  static int[] ff;

  public static void main(String[] args) throws IOException{
    long sttm=System.currentTimeMillis();
    long mod=1000000007l;

    int t=sc.nextInt();
    while(t-->0){
        int n=sc.nextInt();
        int[][] cnt=new int[n][26];
        for(int i=0;i<n;i++){
            String s=sc.next();
            for(char c:s.toCharArray()){
                cnt[i][c-'a']++;
            }
        }
        boolean con=true;
        aa: for(int i=1;i<n;i++){
            for(int j=0;j<26;j++){
                if(cnt[0][j]!=cnt[i][j]){
                    con=false;
                    break aa;
                }
            }
        }
        if(con) nl("YES");
        else nl("NO");
    }

    out.flush();
  }
}

class Pair{
  int x; int y;
  Pair(int x,int y){
    this.x=x;
    this.y=y;
  }
}


import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int t = scn.nextInt();
        while (t-- > 0) {
            int n = scn.nextInt();
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = scn.next();
            }
            HashMap < Character, Integer > map = new HashMap < > ();
            for (int j = 0; j < n; j++) {
                    String str = arr[j];
                    for (int i = 0; i < str.length(); i++) {
                    char ch = str.charAt(i);
                    if (map.containsKey(ch)) {
                        map.put(ch, map.get(ch) + 1);
                    } else {
                        map.put(ch, 1);
                    }
                }
            }
            boolean flag=true;
            for(Character ch:map.keySet())
            {
                if(map.get(ch)<n||map.get(ch)%n!=0)
                {
                  flag = false;
                }

           }

           if(flag)
           {
               System.out.println("YES");
           }
           else{
               System.out.println("NO");
           }
        }
    }

}


import java.util.*;
public class Main
{
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t-->0){

		   int n = sc.nextInt();

		   HashMap<Character,Integer> map = new HashMap<Character,Integer>();

		    for(int p=0;p<n;p++){

		        String str = sc.next();

		        for(int i=0;i<str.length();i++){

		            char ch = str.charAt(i);
		            if(map.containsKey(ch)){

		                map.put(ch,map.get(ch)+1);

		            }else{
		                map.put(ch,1);
		            }

		        }

		    }
		    String ans ="YES";
		   for(Integer c : map.values()){

		         if(c<n || (c%n)!=0){
		             ans = "NO";
		             break;
		         }

		   }

		   System.out.println(ans);

		}

	}
}


import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(buffer.readLine());
        while(N-- > 0){
            int size = Integer.parseInt(buffer.readLine());
            int[] arr = new int[26];
            while(size-- > 0){
                String[] s = buffer.readLine().split("");
                for(int i=0; i<s.length; i++){
                    arr[(int)s[i].charAt(0) -97]++;
                }
            }
            if(size == 1){
                System.out.println("YES");
                continue;
            }
            int flag = 0;
            for(int i=0 ;i<arr.length; i++){
                if(arr[i] %2 != 0){
                    System.out.println("NO");
                    flag = 1;
                    break;
                }
            }
            if(flag == 0)
                System.out.println("YES");
        }
    }
}


import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(buffer.readLine());
        while(N-- > 0){
            int size = Integer.parseInt(buffer.readLine());
            int[] arr = new int[26];
            while(size-- > 0){
                String[] s = buffer.readLine().split("");
                for(int i=0; i<s.length; i++){
                    arr[(int)s[i].charAt(0) -97]++;
                }
            }
            int flag = 0;
            for(int i=0 ;i<arr.length; i++){
                if(arr[i] %2 != 0){
                    System.out.println("NO");
                    flag = 1;
                    break;
                }
            }
            if(flag == 0)
                System.out.println("YES");
        }
    }
}


import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(buffer.readLine());
        while(N-- > 0){
            int size = Integer.parseInt(buffer.readLine());
            if(size == 1){
                System.out.println("YES");
                continue;
            }
            int[] arr = new int[26];
            while(size-- > 0){
                String[] s = buffer.readLine().split("");
                for(int i=0; i<s.length; i++){
                    arr[(int)s[i].charAt(0) -97]++;
                }
            }

            int flag = 0;
            for(int i=0 ;i<arr.length; i++){
                if(arr[i] %2 != 0){
                    System.out.println("NO");
                    flag = 1;
                    break;
                }
            }
            if(flag == 0)
                System.out.println("YES");
        }
    }
}


import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(buffer.readLine());
        while(N-- > 0){
            int size = Integer.parseInt(buffer.readLine());
            int[] arr = new int[26];
            while(size-- > 0){
                String[] s = buffer.readLine().split("");
                for(int i=0; i<s.length; i++){
                    arr[(int)s[i].charAt(0) -97]++;
                }
            }
            if(size == 1){
                System.out.println("YES");
                continue;
            }
            int flag = 0;
            for(int i=0 ;i<arr.length; i++){
                if(arr[i] %size != 0 ){
                    System.out.println("NO");
                    flag = 1;
                    break;
                }
            }
            if(flag == 0)
                System.out.println("YES");
        }
    }
}


import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(buffer.readLine());
        while(N-- > 0){
            int size = Integer.parseInt(buffer.readLine());
            int k = size;
            int[] arr = new int[26];
            while(size-- > 0){
                String[] s = buffer.readLine().split("");
                for(int i=0; i<s.length; i++){
                    arr[(int)s[i].charAt(0) -97]++;
                }
            }
            if(size == 1){
                System.out.println("YES");
                continue;
            }
            int flag = 0;
            for(int i=0 ;i<arr.length; i++){
                if(arr[i] %k != 0 ){
                    System.out.println("NO");
                    flag = 1;
                    break;
                }
            }
            if(flag == 0)
                System.out.println("YES");
        }
    }
}


import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(buffer.readLine());
        while(N-- > 0){
            int size = Integer.parseInt(buffer.readLine());
            if(size == 1){
                System.out.println("YES");
                break;
            }
            int[] arr = new int[26];
            while(size-- > 0){
                String[] s = buffer.readLine().split("");
                for(int i=0; i<s.length; i++){
                    arr[(int)s[i].charAt(0) -97]++;
                }
            }

            int flag = 0;
            for(int i=0 ;i<arr.length; i++){
                if(arr[i] %2 != 0){
                    System.out.println("NO");
                    flag = 1;
                    break;
                }
            }
            if(flag == 0)
                System.out.println("YES");
        }
    }
}


import java.util.*;

public class A {

	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int t = scan.nextInt();
		x:while(t-->0) {
			int n = scan.nextInt();
//			String a[] = new String[n];
			String s = "";
			for(int i =0;i<n;i++)
				s += scan.next();
			HashMap<Character,Integer> c = new HashMap<>();
			for(int i=0;i<s.length();i++) {
				if(c.containsKey(s.charAt(i))) {
					c.put(s.charAt(i), c.get(s.charAt(i))+1);
				}
				else {
					c.put(s.charAt(i), 1);
				}
			}
			for(Map.Entry entry:c.entrySet()) {
				if((int)entry.getValue()%n!=0) {
					System.out.println("NO");
					continue x;
				}
			}
			System.out.println("YES");
		}
	}

}


import java.util.*;

public class A {

	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int t = scan.nextInt();
		x:while(t-->0) {
			int n = scan.nextInt();
//			String a[] = new String[n];
			String s = "";
			for(int i =0;i<n;i++)
				s += scan.next();
			HashMap<Character,Integer> c = new HashMap<>();
			for(int i=0;i<s.length();i++) {
				if(c.containsKey(s.charAt(i))) {
					c.put(s.charAt(i), c.get(s.charAt(i))+1);
				}
				else {
					c.put(s.charAt(i), 1);
				}
			}
			for(Map.Entry entry:c.entrySet()) {
				if((int)entry.getValue()<n) {
					System.out.println("NO");
					continue x;
				}
			}
			System.out.println("YES");
		}
	}

}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=Integer.parseInt(br.readLine());
		while(t-->0){
		    String ss[]=br.readLine().split(" ");
		    int n=Integer.parseInt(ss[0]);
		  //  int f=Integer.parseInt(ss[1]);
		    String s[]=new String[n];
		    Map<Character,Integer> map=new HashMap<>();
		    for (int i=0;i<n;++i){
		        s[i]=br.readLine();
		        for(int j=0;j<s[i].length();++j){
		            if(map.containsKey(s[i].charAt(j))){
		                map.put(s[i].charAt(j),map.get(s[i].charAt(j))+1);
		            }
		            else{
		                map.put(s[i].charAt(j),1);
		            }
		        }

		    }
		    boolean b=true;
		    for(Map.Entry<Character,Integer> entry: map.entrySet()){
		        if(entry.getValue()%n!=0){
		            b=false;
		            break;
		        }
		    }
		    if(b)
		    System.out.println("yes");
		    else
		    System.out.println("no");
		}
	}
}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=Integer.parseInt(br.readLine());
		while(t-->0){
		    String ss[]=br.readLine().split(" ");
		    int n=Integer.parseInt(ss[0]);
		  //  int f=Integer.parseInt(ss[1]);
		    String s[]=new String[n];
		    Map<Character,Integer> map=new HashMap<>();
		    for (int i=0;i<n;++i){
		        s[i]=br.readLine();
		        for(int j=0;j<s[i].length();++j){
		            if(map.containsKey(s[i].charAt(j))){
		                map.put(s[i].charAt(j),map.get(s[i].charAt(j))+1);
		            }
		            else{
		                map.put(s[i].charAt(j),1);
		            }
		        }

		    }
		    boolean b=true;
		    for(Map.Entry<Character,Integer> entry: map.entrySet()){
		        if(entry.getValue()%n==1){
		            b=false;
		            break;
		        }
		    }
		    if(b)
		    System.out.println("yes");
		    else
		    System.out.println("no");
		}
	}
}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=Integer.parseInt(br.readLine());
		while(t-->0){
		    String ss[]=br.readLine().split(" ");
		    int n=Integer.parseInt(ss[0]);
		  //  int f=Integer.parseInt(ss[1]);
		    String s[]=new String[n];
		    Map<Character,Integer> map=new HashMap<>();
		    for (int i=0;i<n;++i){
		        s[i]=br.readLine();
		        for(int j=0;j<s[i].length();++j){
		            if(map.containsKey(s[i].charAt(j))){
		                map.put(s[i].charAt(j),map.get(s[i].charAt(j))+1);
		            }
		            else{
		                map.put(s[i].charAt(j),1);
		            }
		        }

		    }
		    boolean b=true;
		    for(Map.Entry<Character,Integer> entry: map.entrySet()){
		        if(entry.getValue()%2==1){
		            b=false;
		            break;
		        }
		    }
		    if(b)
		    System.out.println("yes");
		    else
		    System.out.println("no");
		}
	}
}


import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class A {

	public static void main(String[] agrs) {
		FastScanner sc = new FastScanner();
		int yo = sc.nextInt();
		while(yo-->0) {
			int n = sc.nextInt();
			String[] arr = new String[n];
			String sum = "";
			for(int i = 0; i < n; i++) {
				arr[i] = sc.next();
				sum += arr[i];
			}

//			System.out.println(sum);
			if(check(sum,n)) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}

		}

	}

	private static boolean check(String string, int n) {
		int[] ch = new int[26];
		for(char e : string.toCharArray()) {
			ch[e-'a']++;
		}
//		for(int e : ch) {
//			System.out.print(e + " ");
//		}
//		System.out.println();
//		System.out.println(5 % 3);
		for(int e : ch) {
			if(e != 0 && (e%n != 0 || e < n)) {
				return false;
			}
		}
		return true;
	}

	static int mod = 1000000007;
	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {
			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class A {

	public static void main(String[] agrs) {
		FastScanner sc = new FastScanner();
		int yo = sc.nextInt();
		while(yo-->0) {
			int n = sc.nextInt();
			String[] arr = new String[n];
			String sum = "";
			for(int i = 0; i < n; i++) {
				arr[i] = sc.next();
			}
			for(String e : arr) {
				sum += e;
			}
//			System.out.println(sum);
			if(check(sum,n)) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}

		}

	}

	private static boolean check(String string, int n) {
		int[] ch = new int[26];
		for(char e : string.toCharArray()) {
			ch[e-'a']++;
		}
		for(int e : ch) {
			if(e%n == 1) {
				return false;
			}
		}
		return true;
	}

	static int mod = 1000000007;
	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {
			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class A {

	public static void main(String[] agrs) {
		FastScanner sc = new FastScanner();
		int yo = sc.nextInt();
		while(yo-->0) {
			int n = sc.nextInt();
			String[] arr = new String[n];
			String sum = "";
			for(int i = 0; i < n; i++) {
				arr[i] = sc.next();
				sum += arr[i];
			}

//			System.out.println(sum);
			if(check(sum,n)) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}

		}

	}

	private static boolean check(String string, int n) {
		int[] ch = new int[26];
		for(char e : string.toCharArray()) {
			ch[e-'a']++;
		}
		for(int e : ch) {
			if(e != 0 && (e%n == 1 || e < n)) {
				return false;
			}
		}
		return true;
	}

	static int mod = 1000000007;
	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {
			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class A {

	public static void main(String[] agrs) {
		FastScanner sc = new FastScanner();
		int yo = sc.nextInt();
		while(yo-->0) {
			int n = sc.nextInt();
			String[] arr = new String[n];
			String sum = "";
			for(int i = 0; i < n; i++) {
				arr[i] = sc.next();
			}
			for(String e : arr) {
				sum += e;
			}
			if(check(sum)) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}

		}

	}

	private static boolean check(String string) {
		int[] ch = new int[26];
		for(char e : string.toCharArray()) {
			ch[e-'a']++;
		}
		for(int e : ch) {
			if(e%2 == 1) {
				return false;
			}
		}
		return true;
	}

	static int mod = 1000000007;
	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {
			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class A {

	public static void main(String[] agrs) {
		FastScanner sc = new FastScanner();
		int yo = sc.nextInt();
		while(yo-->0) {
			int n = sc.nextInt();
			String[] arr = new String[n];
			String sum = "";
			for(int i = 0; i < n; i++) {
				arr[i] = sc.next();
				sum += arr[i];
			}

//			System.out.println(sum);
			if(check(sum,n)) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}

		}

	}

	private static boolean check(String string, int n) {
		int[] ch = new int[26];
		for(char e : string.toCharArray()) {
			ch[e-'a']++;
		}
		for(int e : ch) {
			if(e != 0 && (e/n == 1)) {
				return false;
			}
		}
		return true;
	}

	static int mod = 1000000007;
	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {
			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class A {

	public static void main(String[] agrs) {
		FastScanner sc = new FastScanner();
		int yo = sc.nextInt();
		while(yo-->0) {
			int n = sc.nextInt();
			String[] arr = new String[n];
			String sum = "";
			for(int i = 0; i < n; i++) {
				arr[i] = sc.next();
				sum += arr[i];
			}

//			System.out.println(sum);
			if(check(sum,n)) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}

		}

	}

	private static boolean check(String string, int n) {
		int[] ch = new int[26];
		for(char e : string.toCharArray()) {
			ch[e-'a']++;
		}
		for(int e : ch) {
			if(e != 0 && e%n == 1) {
				return false;
			}
		}
		return true;
	}

	static int mod = 1000000007;
	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {
			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class A {

	public static void main(String[] agrs) {
		FastScanner sc = new FastScanner();
		int yo = sc.nextInt();
		while(yo-->0) {
			int n = sc.nextInt();
			String[] arr = new String[n];
			String sum = "";
			for(int i = 0; i < n; i++) {
				arr[i] = sc.next();
			}
			for(String e : arr) {
				sum += e;
			}
//			System.out.println(sum);
			if(check(sum,n)) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}

		}

	}

	private static boolean check(String string, int n) {
		int[] ch = new int[26];
		for(char e : string.toCharArray()) {
			ch[e-'a']++;
		}
		for(int e : ch) {
			if(e%n == 1 && e != 0) {
				return false;
			}
		}
		return true;
	}

	static int mod = 1000000007;
	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {
			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


import java.io.*;
import java.util.*;
public class Ishu
{
	public static void main(String[] args)
	{
	Scanner scan=new Scanner(System.in);
	int t=scan.nextInt();
	while(t-->0)
		{
		int n=scan.nextInt();
		String str;
		int[] a = new int[26];
		int i;
		for(i=0;i<n;++i)
			{
			str=scan.next();
			for(int j=0;j<str.length();++j)
				a[str.charAt(j)-'a']++;
			}
		for(i=0;i<26;++i)
			if(a[i]%n!=0)
				break;
		if(i==26)
			System.out.println("YES");
		else
			System.out.println("NO");
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;

public class B {
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        FastReader reader = new FastReader();
        int n = reader.nextInt();
        List<Long> arr = new ArrayList<>(n);

        long max = 0;
        for(int i = 0; i < n; i++) {
             arr.add(reader.nextLong());
            max = Math.max(arr.get(i), max);
        }
        Collections.sort(arr);
        long min = Integer.MAX_VALUE;
        long guess = 2;
        while (true) {
            long current = 0;

            for(int j = 0; j < n; j++) {
                long t = (long) Math.pow(guess, j);
                long cost =  Math.abs(t - arr.get(j));
                current += cost;
            }
            min = Math.min(current, min);
            if(System.currentTimeMillis() - start >= 500) {
                break;
            }

            guess++;
        }
        System.out.println(min);
        //why not sort it
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class A {
    public static void main(String[] args) {
        FastReader reader = new FastReader();
        int tests = reader.nextInt();
        for(int test = 1; test <= tests; test++) {
            int n = reader.nextInt();
            int[] chars = new int[40];

            for(int i = 0; i < n; i++) {
                String next = reader.next();
                for(int j = 0; j < next.length(); j++) {
                    chars[next.charAt(j)-'a']++;
                }
            }
            boolean check = true;
            for(int i = 0; i < chars.length; i++) {
                if(chars[i] % n != 0) {
                    check = false;
                    break;
                }
            }
            if(check) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.Scanner;
public class Main
{
    public static String check(int[] ascii,int n)
    {
        for(int i=0;i<ascii.length;i++)
	    {
	        if(ascii[i]%n!=0)
	        {
	            return "NO";
    	    }
	    }
	    return "YES";
    }
	public static void main(String[] args)
	{
	    Scanner sc=new Scanner(System.in);
	    int t=sc.nextInt();
	    for(int i=0;i<t;i++)
	    {
	        int n=sc.nextInt();
	        int ascii[]=new int[26];//representing all letters
	        for(int j=0;j<n;j++)
	        {
	            String s=sc.next();
	            char[] a=s.toCharArray();
	            for(int k=0;k<a.length;k++)
	            {
	                int temp=a[k];//ascii value of the letter
	                ascii[temp-97]++;
	            }
	        }
	        System.out.println(check(ascii,n));
	    }
		sc.close();
	}
}


import java.util.Scanner;
public class Main
{
    public static String check(int[] ascii)
    {
        for(int i=0;i<ascii.length;i++)
	    {
	        if(ascii[i]!=0 && ascii[i]%2!=0)
	        {
	            return "NO";
    	    }
	    }
	    return "YES";
    }
	public static void main(String[] args)
	{
	    Scanner sc=new Scanner(System.in);
	    int t=sc.nextInt();
	    for(int i=0;i<t;i++)
	    {
	        int n=sc.nextInt();
	        int ascii[]=new int[26];//representing all letters
	        for(int j=0;j<n;j++)
	        {
	            String s=sc.next();
	            if(n==1) {//base case
	                System.out.println("YES");
	                break;
	            }
	            char[] a=s.toCharArray();
	            for(int k=0;k<a.length;k++)
	            {
	                int temp=a[k];//ascii value of the letter
	                ascii[temp-97]++;
	            }
	        }
	        System.out.println(check(ascii));
	    }
		sc.close();
	}
}


import java.util.Scanner;
public class Main
{
    public static String check(int[] ascii,int n)
    {
        for(int i=0;i<ascii.length;i++)
	    {
	        if(ascii[i]%n!=0)
	        {
	            return "NO";
    	    }
	    }
	    return "YES";
    }
	public static void main(String[] args)
	{
	    Scanner sc=new Scanner(System.in);
	    int t=sc.nextInt();
	    for(int i=0;i<t;i++)
	    {
	        int n=sc.nextInt();
	        int ascii[]=new int[26];//representing all letters
	        for(int j=0;j<n;j++)
	        {
	            String s=sc.next();
	            if(n==1) {//base case
	                System.out.println("YES");
	                break;
	            }
	            char[] a=s.toCharArray();
	            for(int k=0;k<a.length;k++)
	            {
	                int temp=a[k];//ascii value of the letter
	                ascii[temp-97]++;
	            }
	        }
	        System.out.println(check(ascii,n));
	    }
		sc.close();
	}
}


import java.util.Scanner;
public class Main
{
    public static String check(int[] ascii,int n)
    {
        for(int i=0;i<ascii.length;i++)
	    {
	        if(ascii[i]>=n && ascii[i]%n!=0)
	        {
	            return "NO";
    	    }
    	    else if(ascii[i]>0 && ascii[i]<n)
    	    {
    	        return "NO";
    	    }
	    }
	    return "YES";
    }
	public static void main(String[] args)
	{
	    Scanner sc=new Scanner(System.in);
	    int t=sc.nextInt();
	    for(int i=0;i<t;i++)
	    {
	        int n=sc.nextInt();
	        int ascii[]=new int[26];//representing all letters
	        for(int j=0;j<n;j++)
	        {
	            String s=sc.next();
	            if(n==1) {//base case
	                System.out.println("NO");
	                break;
	            }
	            char[] a=s.toCharArray();
	            for(int k=0;k<a.length;k++)
	            {
	                int temp=a[k];//ascii value of the letter
	                ascii[temp-97]++;
	            }
	        }
	        System.out.println(check(ascii,n));
	    }
		sc.close();
	}
}


import java.util.Scanner;
public class Main
{
    public static String check(int[] ascii,int n)
    {
        for(int i=0;i<ascii.length;i++)
	    {
	        if(ascii[i]>=n && ascii[i]%n!=0)
	        {
	            return "NO";
    	    }
    	    else if(ascii[i]>0 && ascii[i]<n)
    	    {
    	        return "NO";
    	    }
	    }
	    return "YES";
    }
	public static void main(String[] args)
	{
	    Scanner sc=new Scanner(System.in);
	    int t=sc.nextInt();
	    for(int i=0;i<t;i++)
	    {
	        int n=sc.nextInt();
	        int ascii[]=new int[26];//representing all letters
	        for(int j=0;j<n;j++)
	        {
	            String s=sc.next();
	            if(n==1) {//base case
	                System.out.println("YES");
	                break;
	            }
	            char[] a=s.toCharArray();
	            for(int k=0;k<a.length;k++)
	            {
	                int temp=a[k];//ascii value of the letter
	                ascii[temp-97]++;
	            }
	        }
	        System.out.println(check(ascii,n));
	    }
		sc.close();
	}
}


import java.util.Scanner;
public class Main
{
    public static String check(int[] ascii,int n)
    {
        for(int i=0;i<ascii.length;i++)
	    {
	        if(ascii[i]!=0 && ascii[i]%n!=0)
	        {
	            return "NO";
    	    }
	    }
	    return "YES";
    }
	public static void main(String[] args)
	{
	    Scanner sc=new Scanner(System.in);
	    int t=sc.nextInt();
	    for(int i=0;i<t;i++)
	    {
	        int n=sc.nextInt();
	        int ascii[]=new int[26];//representing all letters
	        for(int j=0;j<n;j++)
	        {
	            String s=sc.next();
	            if(n==1) {//base case
	                System.out.println("YES");
	                break;
	            }
	            char[] a=s.toCharArray();
	            for(int k=0;k<a.length;k++)
	            {
	                int temp=a[k];//ascii value of the letter
	                ascii[temp-97]++;
	            }
	        }
	        System.out.println(check(ascii,n));
	    }
		sc.close();
	}
}


import java.util.Scanner;
public class Main
{
    public static String check(int[] ascii)
    {
        for(int i=0;i<ascii.length;i++)
	    {
	        if(ascii[i]!=0 && ascii[i]%2!=0)
	        {
	            return "NO";
    	    }
	    }
	    return "YES";
    }
	public static void main(String[] args)
	{
	    Scanner sc=new Scanner(System.in);
	    int t=sc.nextInt();
	    for(int i=0;i<t;i++)
	    {
	        int n=sc.nextInt();
	        int ascii[]=new int[26];//representing all letters
	        for(int j=0;j<n;j++)
	        {
	            String s=sc.next();
	            char[] a=s.toCharArray();
	            for(int k=0;k<a.length;k++)
	            {
	                int temp=a[k];//ascii value of the letter
	                ascii[temp-97]++;
	            }
	        }
	        System.out.println(check(ascii));
	    }
		sc.close();
	}
}


import java.util.*;
import java.util.function.LongFunction;
public class test{
	public static void main(String args[])
	{
		Scanner take=new Scanner(System.in);
		int t=take.nextInt();
		String s[];
		int n,i,j,a[],k;
		while(t--!=0)
		{
			n=take.nextInt();
			s=new String[n];
			a=new int[26];
			for(i=0;i<n;i++) s[i]=take.next();
			for(i=0;i<n;i++)
			{
				for(j=0;j<s[i].length();j++)
				{
					a[s[i].charAt(j)-'a']++;
				}
			}
			for(i=0;i<26;i++)
			{
				if(a[i]%n!=0)
				{	System.out.println("NO");
					break;
				}
			}
			if(i==26) System.out.println("YES");
		}
	}

}


import java.util.*;
import java.util.function.LongFunction;
public class test{
	public static void main(String args[])
	{
		Scanner take=new Scanner(System.in);
		int t=take.nextInt();
		String s[];
		int n,i,j,a[];
		while(t--!=0)
		{
			n=take.nextInt();
			s=new String[n];
			a=new int[26];
			for(i=0;i<n;i++) s[i]=take.next();
			for(i=0;i<n;i++)
			{
				for(j=0;j<s[i].length();j++)
				{
					a[s[i].charAt(j)-'a']++;
				}
			}
			for(i=0;i<26;i++)
			{
				if(a[i]%n!=0)
				{	System.out.println("NO");
					break;
				}
			}
			if(i==26) System.out.println("YES");
		}
	}

}


import java.util.*;
import java.io.*;
import java.math.*;
/*
javac Main.java
java Main <input.txt> output.txt
*/
public class Main
{

    public static void process()throws IOException
    {
      int n=ni();
      int p=n;
      int freq[]=new int[26];
      Arrays.fill(freq,0);
      while(n-->0)
      {
        String s=nn();
        for(int i=0;i<s.length();i++)
        {
          char ch=s.charAt(i);
         freq[ch-'a']++;
        }
      }

      int flag=0;
      for(int i=0;i<26;i++)
      {

        if(freq[i]>0)
        {

        if(freq[i]%p==0)

          continue;
        else
          {flag=-1;break;}}
      }
      if(flag==-1)
        pn("NO");
      else
        pn("YES");

    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;
         //PrintWriter out=new PrintWriter("output");
        //oj = System.getProperty("ONLINE_JUDGE") != null;
        //if(!oj) sc=new AnotherReader(100);

      //int i=1;
    int T=ni(); while(T-->0)
      //{
        //p("Case #"+i+": ");
            process();
            //i++;
      //}
        long s = System.currentTimeMillis();

        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();
    }
    static void sort(long arr[],int n)
    {
    shuffle(arr,n);
    Arrays.sort(arr);
    }
    static void shuffle(long arr[],int n)
    {
        Random r=new Random();
        for(int i=0;i<n;i++)
        {
          long temp=arr[i];
          int pos=i+r.nextInt(n-i);
          arr[i]=arr[pos];
          arr[pos]=temp;
        }
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static String nn()throws IOException{return sc.next();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static int[] iarr(int N)throws IOException{int[]ARR=new int[N];for(int i=0;i<N;i++){ARR[i]=ni();}return ARR;}
    static long[] larr(int N)throws IOException{long[]ARR=new long[N];for(int i=0;i<N;i++){ARR[i]=nl();}return ARR;}
    static boolean multipleTC=false;

/////////////////////////////////////////////////////////////////////////////////////////////////////////
    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}


import java.util.*;
import java.io.*;
import java.math.*;
/*
javac Main.java
java Main <input.txt> output.txt
*/
public class Main
{

    public static void process()throws IOException
    {
      int n=ni();
      HashMap<Character,Long> hm=new HashMap<Character,Long>();
      String fin="";
      while(n-->0)
      {
        String s=nn();
        fin+=s;
      }
      for(int i=0;i<fin.length();i++)
      {

        char ch=fin.charAt(i);
        if(!hm.containsKey(ch))
            hm.put(ch,1l);
        else
            hm.put(ch,hm.get(ch)+1l);

      }
      int flag=0;
      Set<Map.Entry<Character,Long>> st=hm.entrySet();
    for(Map.Entry<Character,Long> me:st)
    {
        long x=me.getValue();
        if(x%2!=0)
          {flag=1;break;}

    }
    if(flag==1)
      pn("NO");
    else
      pn("YES");
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;
         //PrintWriter out=new PrintWriter("output");
        //oj = System.getProperty("ONLINE_JUDGE") != null;
        //if(!oj) sc=new AnotherReader(100);

      //int i=1;
    int T=ni(); while(T-->0)
      //{
        //p("Case #"+i+": ");
            process();
            //i++;
      //}
        long s = System.currentTimeMillis();

        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();
    }
    static void sort(long arr[],int n)
    {
    shuffle(arr,n);
    Arrays.sort(arr);
    }
    static void shuffle(long arr[],int n)
    {
        Random r=new Random();
        for(int i=0;i<n;i++)
        {
          long temp=arr[i];
          int pos=i+r.nextInt(n-i);
          arr[i]=arr[pos];
          arr[pos]=temp;
        }
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static String nn()throws IOException{return sc.next();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static int[] iarr(int N)throws IOException{int[]ARR=new int[N];for(int i=0;i<N;i++){ARR[i]=ni();}return ARR;}
    static long[] larr(int N)throws IOException{long[]ARR=new long[N];for(int i=0;i<N;i++){ARR[i]=nl();}return ARR;}
    static boolean multipleTC=false;

/////////////////////////////////////////////////////////////////////////////////////////////////////////
    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}


import java.util.*;
import java.lang.*;
impot java.io.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int  t = sc.nextInt();
		while(t>0){
		    t--;
		    int n= sc.nextInt();
		    String s[] = new String[n] ;
		    for(int i=0;i<n;i++){
		        s[i] = sc.next();
		    }
		    int a[] =  new int[26];
		    for(int i=0;i<n;i++){
		        a[i]=0;
		    }
		    int total=0;
		    for(int i=0;i<n;i++){
		        total += s[i].length();
		        for(int j=0;j<s[i].length();j++){
		            a[(int)(s[i].charAt(j)-'a')]++;
		        }
		    }
		    boolean posses = false;
		    for(int i=0;i<26;i++){
		        if(a[i]%n!=0){
		            posses = true;
		        }
		    }
		    if(total%n!=0||posses){
		        System.out.println("NO");
		    }else{
		        System.out.println("YES");
		    }
		}
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int  t = sc.nextInt();
		while(t>0){
		    t--;
		    int n= sc.nextInt();
		    String s[] = new String[n] ;
		    for(int i=0;i<n;i++){
		        s[i] = sc.next();
		    }
		    int a[] =  new int[26];
		    for(int i=0;i<26;i++){
		        a[i]=0;
		    }
		    int total=0;
		    for(int i=0;i<n;i++){
		        total += s[i].length();
		        for(int j=0;j<s[i].length();j++){
		            a[(int)(s[i].charAt(j)-'a')]++;
		        }
		    }
		    boolean posses = false;
		    for(int i=0;i<26;i++){
		        if(a[i]%n!=0){
		            posses = true;
		        }
		    }
		    if(total%n!=0||posses){
		        System.out.println("NO");
		    }else{
		        System.out.println("YES");
		    }
		}
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int  t = sc.nextInt();
		while(t>0){
		    t--;
		    int n= sc.nextInt();
		    String s[] = new String[n] ;
		    for(int i=0;i<n;i++){
		        s[i] = sc.next();
		    }
		    int a[] =  new int[27];
		    for(int i=0;i<n;i++){
		        a[i]=0;
		    }
		    int total=0;
		    for(int i=0;i<n;i++){
		        total += s[i].length();
		        for(int j=0;j<s[i].length();j++){
		            a[(int)(s[i].charAt(j)-'a')]++;
		        }
		    }
		    boolean posses = false;
		    for(int i=0;i<26;i++){
		        if(a[i]%n!=0){
		            posses = true;
		        }
		    }
		    if(total%n!=0||posses){
		        System.out.println("NO");
		    }else{
		        System.out.println("YES");
		    }
		}
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int  t = sc.nextInt();
		while(t>0){
		    t--;
		    int n= sc.nextInt();
		    String s[] = new String[n] ;
		    for(int i=0;i<n;i++){
		        s[i] = sc.next();
		    }
		    int a[] =  new int[26];
		    for(int i=0;i<n;i++){
		        a[i]=0;
		    }
		    int total=0;
		    for(int i=0;i<n;i++){
		        total += s[i].length();
		        for(int j=0;j<s[i].length();j++){
		            a[(int)(s[i].charAt(j)-97)]++;
		        }
		    }
		    boolean posses = false;
		    for(int i=0;i<26;i++){
		        if(a[i]%n!=0){
		            posses = true;
		        }
		    }
		    if(total%n!=0||posses){
		        System.out.println("NO");
		    }else{
		        System.out.println("YES");
		    }
		}
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int  t = sc.nextInt();
		while(t>0){
		    t--;
		    int n= sc.nextInt();
		    String s[] = new String[n] ;
		    for(int i=0;i<n;i++){
		        s[i] = sc.next();
		    }
		    int a[] =  new int[26];
		    for(int i=0;i<n;i++){
		        a[i]=0;
		    }
		    int total=0;
		    for(int i=0;i<n;i++){
		        total += s[i].length();
		        for(int j=0;j<s[i].length();j++){
		            a[(int)(s[i].charAt(j)-'a')]++;
		        }
		    }
		    boolean posses = false;
		    for(int i=0;i<26;i++){
		        if(a[i]%n!=0){
		            posses = true;
		        }
		    }
		    if(total%n!=0||posses){
		        System.out.println("NO");
		    }else{
		        System.out.println("YES");
		    }
		}
	}
}


import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.ArrayList;

public class Main {

    public static void Solve(Cin in,PrintWriter out) {
        int n = in.nextInt();
        HashMap<Character,Integer> mp = new HashMap<>();
        ArrayList<Character> a = new ArrayList<>();
        boolean ok = true;
        for(int i = 0; i < n; i++) {
            String temp = in.next();
            for (char ch : temp.toCharArray())
                mp.put(ch, mp.getOrDefault(ch, 0) + 1);
            for(char ch : temp.toCharArray())
                a.add(ch);
        }
        for(char ch : a) {
            int num = mp.get(ch);
            if(num % n == 0) {

            } else {
                ok = false;
                break;
            }
        }
        out.print((ok) ? "YES\n":"NO\n");
    }
  // .... .. .. . ....... . ... .... .. .. ..... ..
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out); // .. out
        Cin in= new Cin();
//        int tt = in.nextInt();
//        for(int T = 1; T <= tt; T++) {//  .. Test Case
//            out.print("Test "+T+": ");
                Solve(in, out);
//        }
        out.close();
    }
    static class Cin { // ... Input
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        String next() {
            while(!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        String nextLine() {
            StringBuilder strb = new StringBuilder();
            try {
                st = new StringTokenizer(reader.readLine());
                while(st.hasMoreTokens()) {
                    strb.append(st.nextToken());
                    strb.append(" ");
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return strb.toString().trim();
        }
        int nextInt() {return Integer.parseInt(next());}
        long nextLong() {return  Long.parseLong(next());}
        int[] nextArrInt(int n) {
            int[] r = new int[n];
            for(int i = 0; i < n; i++) r[i] = nextInt();
            return r;
        }
    }
}
//.... ..
//..... ..


import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.ArrayList;

public class Main {

    public static void Solve(Cin in,PrintWriter out) {
        int n = in.nextInt();
        HashMap<Character,Integer> mp = new HashMap<>();
        ArrayList<Character> a = new ArrayList<>();
        boolean ok = true;
        String[] temp = new String[n];
        for(int i = 0; i < n; i++) {
            temp[i] = in.next();
            for (char ch : temp[i].toCharArray())
                mp.put(ch, mp.getOrDefault(ch, 0) + 1);
            for(char ch : temp[i].toCharArray())
                a.add(ch);
        }
        for(char ch : a) {
            int num = mp.get(ch);
            if(num >= n) {

            } else {
                ok = false;
                break;
            }
        }

        out.print((ok) ? "YES\n":"NO\n");
    }

  // ....
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Cin in= new Cin();
        for(int i = in.nextInt(); i > 0; i--)
            Solve(in,out);
        out.close();
    }
    static class Cin {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        String next() {
            while(!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        String nextLine() {
            StringBuilder strb = new StringBuilder();
            try {
                st = new StringTokenizer(reader.readLine());
                while(st.hasMoreTokens()) {
                    strb.append(st.nextToken());
                    strb.append(" ");
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return strb.toString().trim();
        }
        int nextInt() {return Integer.parseInt(next());}
        long nextLong() {return  Long.parseLong(next());}
        int[] nextArrInt(int n) {
            int[] r = new int[n];
            for(int i = 0; i < n; i++) r[i] = nextInt();
            return r;
        }
    }
}


#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#define int long long int

struct adjacencylist
{
   int nodeindex;
   int weight;
  struct adjacencylist* adj;
};
struct minheap
{
    int mindist;
    int vertex;
};

struct adjacencylist *graph[100002],*traverse;

int swap(int *a,int *b){ int temp=*a; *a=*b; *b=temp;}
int minimum(int a, int b){ if(a<=b)return a; else return b;}

int add_edge(int a,int b,int distance)
{
    traverse=(struct adjacencylist*)malloc(sizeof(struct adjacencylist));
    traverse->adj=graph[a];
    traverse->nodeindex=b;
    traverse->weight=distance;
    graph[a]=traverse;
}
int main()
{
    int nodes,edges,distance,a,b,update,parent,pick,cur,ok=0,adjacent,edge,c1,c2,small,stop;
    scanf("%lld%lld",&nodes,&edges); //nodes and edges
    int adjac[nodes+1],previous[nodes+1];
    memset(adjac,0,sizeof(adjac));
    struct adjacencylist *ptr;
    //graph input in linked list begins
    for(int i=0;i<edges;i++)
    {
     scanf("%lld%lld%lld",&a,&b,&distance);
     adjac[a]++;
     add_edge(a,b,distance);
     add_edge(b,a,distance);
     adjac[b]++;
    }
    //Djkstra algorithm
    int source=1;
    int visit[nodes+1],dist[nodes+1];
    for(int i=1;i<=nodes;i++){dist[i]=LLONG_MAX; visit[i]=0;}
    visit[source]=1;
    dist[source]=0;

    //Building Minimum Heap
    struct minheap* heap=(struct minheap*)malloc((nodes+1)*sizeof(struct minheap));
    int cnt=1;
    int map[nodes+1];
    heap[1].mindist=dist[source];
    heap[1].vertex=source;
    map[heap[1].vertex]=1;
    cnt++;
    for(int i=1;i<=nodes;i++)
    {
      if(i==source){previous[i]=1;continue;}
      else if(i!=source)previous[i]=-1;
      heap[cnt].mindist=dist[i];
      heap[cnt].vertex=i;
      map[heap[cnt].vertex]=cnt;
      cnt++;
    }
    int heapsize=cnt-1;
    while(heapsize>0)
    {
      pick=heap[1].vertex;

      /*Deletion in Min. Heap*/
      map[heap[heapsize].vertex]=map[heap[1].vertex];
      heap[1].mindist=heap[heapsize].mindist;
      heap[1].vertex=heap[heapsize].vertex;
      heapsize--;
      /*Compare the first node with it's child nodes*/
      cur=1;
      while(1)
      {
          c1=2*cur;  //left child
          c2=(2*cur)+1; //right child
          small=LLONG_MAX;

          if(c1<=heapsize && heap[c1].mindist<heap[cur].mindist)small=c1;
          if(c2<=heapsize && heap[c2].mindist<heap[cur].mindist)
          {
              if(small!=LLONG_MAX){if(heap[c2].mindist<heap[small].mindist)small=c2;}
              else if(small==LLONG_MAX)small=c2;
          }
          if(small==LLONG_MAX)break;

          swap(&map[heap[small].vertex],&map[heap[cur].vertex]);
          swap(&heap[small].mindist,&heap[cur].mindist);
          swap(&heap[small].vertex,&heap[cur].vertex);
          cur=small;
      }
    //Relax the nodes adjacent to picked vertexk
      ptr=graph[pick];
      ok=0,adjacent,edge;
      stop=adjac[pick];
      while(stop>0 && dist[pick]!=LLONG_MAX)
      {
        adjacent=ptr->nodeindex;
        edge=ptr->weight;
        if(map[adjacent]<=heapsize && dist[pick]+edge<dist[adjacent] && dist[pick]!=LLONG_MAX && edge>=0)
        {
             dist[adjacent]=dist[pick]+edge;//relaxation of nodes adjacent to picked vertex
             previous[adjacent]=pick;
             update=map[adjacent];
             heap[update].mindist=dist[pick]+edge;
             parent=update/2;

             while(heap[update].mindist<heap[parent].mindist && parent>=1 && update>=1)
               {
                   swap(&map[heap[parent].vertex],&map[heap[update].vertex]);
                   swap(&heap[update].mindist,&heap[parent].mindist);
                   swap(&heap[update].vertex,&heap[parent].vertex);

                   update=parent;
                   parent=update/2;
               }
        }
        ptr=ptr->adj;
        stop--;
      }
    }
    int shortestpath[nodes+1],index=1,answer_exist=1,prev=nodes;
    shortestpath[index]=nodes;
    index++;
    while(1)
    {
      prev=previous[prev];
      if(prev==-1){answer_exist=0;break;}
      shortestpath[index]=prev;
      if(prev==1){break;}
      index++;
    }
    if(answer_exist==0){printf("-1\n");return 0;}
    for(int i=index;i>0;i--) printf("%lld ",shortestpath[i]);
    printf("\n");
    free(graph);
    free(heap);
    free(traverse);
    free(ptr);
    return 0;
}