// Danny Wasserman
// Solution for BHCSI Contest Question Frequency
// 7/26/2011

import java.util.*;
import java.io.*;

public class frequency
{
	public static void main(String[] args) throws IOException
	{
		Scanner in = new Scanner(new File("frequency.in"));
		//read in the number of test cases
		int cases = in.nextInt();
		//Run through the number of test cases
		for(int tc = 1; tc <= cases; tc++)
		{
			//Read in the number of words for this test case.
			int words = in.nextInt();
			
			//initiate an array of size 26 (one spot for each letter of the alphabet) to store the frequency of each letter
			int[] frequency = new int[26];
			
			//Process each word
			while(words--!=0)
				processWord(frequency, in.next());
			
			//initiate a boolean array for each letter, so I never reprint a letter.
			boolean[] used = new boolean[26];
			//print the header.
			System.out.print("Frequencies #" + tc + ": ");
			//Loop to print out the 26 letters
			for(int i = 0; i < 26; i++)
			{
				//find the least used letter alphabetically
				int index = 0;
				while(used[index])
					index++;
				//check all the letters for a letter that is used more frequently than the current best.
				for(int j = 0; j < 26; j++)
				{
					if(!used[j] && frequency[j] > frequency[index])
						index = j;
				}
				
				//Set the letter that is going to be printed to "used"
				used[index]=true;
				//Print out the current best letter
				System.out.print((char)(index+'a'));
			}
			//print new line character for the next set
			System.out.println();
		}
	}
	public static void processWord(int[] frequency, String word)
	{
		//run through each letter of the word and increment the frequency of each letter in the word
		// to get the index of where the letter is represented in the frequency array subtract the character value for 'a'
		char[] arr = word.toCharArray();
		for(int i = 0; i < arr.length; i++)
			frequency[arr[i]-'a']++;
	}
}