#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<iterator>
#include<string>
#include<sstream>
#include<cassert>
#include<ctime>
 
#define MP make_pair
#define PII pair<int,int>
#define PB push_back
#define X first
#define Y second
#define oo 2000000000
#define MOD 1000000007
#define LL long long int
 
using namespace std;
int N;
char tmp[22];
vector<string> array;
int L[22];
int dp[502];
int label[22][22];
PII val[502];
string ds[502];
 
 
int total_l;
 
bool isPrefix(int id1,int id2){
    PII p1=val[id1];
    PII p2=val[id2];
    if((L[p1.X]-p1.Y) > (L[p2.X]-p2.Y) ) return false;
    for(int i=0;i<L[p1.X]-p1.Y;i++){
        if(array[p1.X][i+p1.Y] != array[p2.X][i+p2.Y]) return false;
    }
    return true;
}
 
int check(int id){
    PII lb = val[id];
    int &r = dp[id];
    int tp;
    if(r != -1 ) return r;
    r = oo;
    if(!lb.Y){
        for(int i=0;i<N;i++){
            if(i==lb.X) continue;
            if(isPrefix(label[i][0],label[lb.X][0])){
                tp  = L[i]+check( label[lb.X][L[i]] );
                if(tp >= oo) continue;
                if(r > tp ) r = tp , ds[id] = array[i] + ds[label[lb.X][L[i]]];
                else if(r == tp) ds[id] = min(ds[id],array[i] + ds[label[lb.X][L[i]]]);
 
            }
            else if(isPrefix(label[lb.X][0],label[i][0])){
                tp = L[lb.X] + check( label[i][L[lb.X]] );
                if(tp >= oo) continue;
                if(r > tp) r = tp , ds[id] = array[lb.X] + ds[label[i][L[lb.X]]];
                else if(r == tp) ds[id] = min(ds[id],array[lb.X]+ds[label[i][L[lb.X]]]);
            }
        }
        return r;
    }
    for(int i=0;i<N;i++){
        if(isPrefix(label[i][0],id)){
            tp = L[i]+check( label[lb.X][lb.Y+L[i]] );
            if(tp >= oo) continue;
            if(r > tp) r = tp , ds[id] =  array[i] + ds[label[lb.X][lb.Y+L[i]]];
            else if(r == tp) ds[id] = min(ds[id] , array[i] + ds[label[lb.X][lb.Y+L[i]]]);
        }
        else if(isPrefix(id,label[i][0])){
            tp = L[lb.X]-lb.Y+check( label[i][L[lb.X]-lb.Y] );
            if(tp >= oo) continue;
            if(r > tp) r = tp , ds[id] = array[lb.X].substr(lb.Y)+ds[label[i][L[lb.X]-lb.Y]];
            else if(r == tp) ds[id] = min(ds[id] , array[lb.X].substr(lb.Y)+ds[label[i][L[lb.X]-lb.Y]] );
        }
    }
    return r;
}
 
int main(){
    //freopen("input.txt","r",stdin);
    int T = 1;
    while(scanf("%d",&N),N){
        for(int i=0;i<N;i++){
            scanf("%s",tmp);
            array.PB(string(tmp));
        }
        sort(array.begin(),array.end());
        for(int i=0;i<N;i++)
            L[i]=array[i].length();
        total_l=0;
        for(int i=0;i<N;i++)
            for(int j=0;j<L[i];j++){
                label[i][j] = ++total_l , val[total_l] = MP(i,j);
            }
        ++total_l;
        for(int i=0;i<N;i++)
            label[i][L[i]] = total_l;
        for(int i=0;i<=total_l;i++)
            dp[i]=-1 , ds[i] = string("");
        dp[total_l]=0;
        int ans=oo;
        string ss;
        for(int i=1;i<N;i++){
            int tp = check(label[i][0]);
            if(tp == oo) continue;
            if(tp < ans) ans = tp ,ss = ds[label[i][0]];
            else if(tp == ans) ss = min(ss , ds[label[i][0]]);
        }
        assert(ans != oo);
        if(ans>1)
            printf("Code %d: %d bits\n",T,ans);
        else
            printf("Code %d: %d bit\n",T,ans);
        for(unsigned int i=0;i<ss.length();i++){
            putchar(ss[i]);
            if(i%20==19 || 1+i==ss.length()) puts("");
        }
        puts("");
        ++T;
        array.clear();
    }
    return 0;
}