/**********************************************************************
 *
 *
 * Solution Algorithm
 * ------------------
 * First we remove strings that appear as substrings in other strings.
 * Not only is this an obvious possibility to gain speed, but it's even
 * necessary for the main algorithm to work.
 *
 * As a second step, we compute the "overlap" of each pair of strings:
 *
 *     overlap[f][s] := How much can strings f (first) and s (second) overlap?
 *
 * The third step is the main algorithm. It uses dynamic programming
 * with the table "minLen":
 *
 *     minLen[m][f] := Length of the shortest common superstring
 *                     of the strings in m (which is a mask representing
 *                     a subset of the input words) starting with
 *                     first word f.
 *
 *
 * Time Complexity
 * ---------------
 * Let's say we have N strings, each of length L. We can split the
 * analysis into the three steps:
 *
 *     1) N^2 tests, each takes L^2 time            =>  O( N^2 * L^2 )
 *     2) N^2 tests, each takes L^2 time            =>  O( N^2 * L^2 )
 *     3) 2^N * N table entries, each takes N time  =>  O( 2^N * N^2 )
 *
 * For N=15 and L=100 (our worst case), this results in:
 *
 *     1) 2,250,000
 *     2) 2,250,000
 *     3) 7,372,800
 *
 *
 * Memory Complexity
 * -----------------
 * Here only the third step matters. The two tables bestLength and
 * bestPred both have 2^N*N int entries. For N=10, this leads to
 * 2 * 2^10 * 10 = 20,480 entires. Peanuts.
 *
 **********************************************************************/

#include <iostream>
#include <string>
using namespace std;

int main () {
  int S;
  cin >> S;
  for( int s=1; s<=S; s++ ){
    cout << "Scenario #" << s << ":" << endl;
    
    //--- Read scenario data.
    int n;
    cin >> n;
//    cout<<n<<endl;
    string words[150];
    for( int i=0; i<n; i++ )
    {
      cin >> words[i];
//      cout<<words[i].length()<<" "<<words[i]<<endl;
     }
    
//    cout<<"OKOKOK"<<endl;
    //--- Throw out words that are included in other words.
    int f = 1;
    while (f)
    {
      f = 0;
    	for( int i=0; i<n && !f; i++ )
     	 for( int j=0; j<n && !f; j++ )
				if( i!=j && words[j].find(words[i])!=string::npos )
				{
				  words[i--] = words[--n];
				  f = 1; break;
				}
		}
    
    //--- Precompute overlap values.
//    cout<<"OKOKOK"<<endl;
    int overlap[150][150];
    for( int f=0; f<n; f++ ){
      for( int s=0; s<n; s++ ){
	int& lap = overlap[f][s] = words[f].size();
	while( words[f].substr(words[f].size()-lap) != words[s].substr(0,lap) )
	  lap--;
      }
    }
    
    //--- Dance the funky DP.
    int N = 1 << n;
    int minLen[1<<16][16];
    for( int m=1; m<N; m++ ){
      for( int f=0; f<n; f++ ) if( m & (1<<f) ){
	int m2 = m ^ (1<<f);
	minLen[m][f] = m2 ? (1<<30) : words[f].size();
	for( int s=0; s<n; s++ ) if( m2 & (1<<s) )
	  minLen[m][f] = min((int) words[f].size() - overlap[f][s] + minLen[m2][s], minLen[m][f]);
      }
    }
    
    //--- Reconstruct and print the superstring.
    int m = N - 1;
    int prev = -1;
    while( m ){
      int best = -1;
      int bestLen;
      string bestAdd;
      for( int f=0; f<n; f++ ) if( m & (1<<f) ){
	int len = minLen[m][f];
	string add = words[f];
	if( prev >= 0 ){
	  len -= overlap[prev][f];
	  add = add.substr( overlap[prev][f] );
	}
	if( best<0  ||  len<bestLen  ||  len==bestLen && add<bestAdd ){
	  best = f;
	  bestLen = len;
	  bestAdd = add;
	}
      }
      // if( prev < 0 ) cout << "---> " << minLen[m][f] << endl;
      cout << bestAdd;
      prev = best;
      m ^= 1<<best;
    }
    cout << endl << endl;
  }
}
