#include<stdio.h>
#include<map>
#include<iostream>
#include<cstring>
#include<memory.h>
#include<algorithm>
using namespace std;
int n,i,j,k,pw,ls,p[5555],pm[5555],vn,exist[5555],mm,an;
string carry;
char dump[2222222],s[2222222];
map<unsigned long long,short>ma;
char f[5555];
unsigned long long hash,words[5555],me;
pair<unsigned long long,string>a[2222222];
void spread(int k){
int i;
for(i=k;i;i=(i-1)&k)if(!exist[i]){
exist[i]=1;
words[i]=words[k];
}
}
int main(){
freopen("covertexts.in","r",stdin);
freopen("covertexts.out","w",stdout);
scanf("%d",&n);gets(dump);
for(i=1;i<=n;i++){
pw=(1<<(i-1));
gets(s);ls=strlen(s);carry="";hash=0;
for(j=0;j<ls;j++)if(s[j]==' '){
if(carry!=""){
ma[hash]|=pw;
a[++an]=make_pair(hash,carry);
}
carry="";hash=0;
}else{carry+=s[j];hash=hash*239+s[j];}
if(carry!=""){
ma[hash]|=pw;
a[++an]=make_pair(hash,carry);
}
}
for(map<unsigned long long,short>::iterator it=ma.begin();it!=ma.end();it++)if(exist[it->second]==0){
words[it->second]=it->first;
exist[it->second]=1;
spread(it->second);
}
memset(f,63,sizeof(f));
f[0]=0;
for(i=0;i<(1<<n);i++)if(f[i]<20){
mm=(1<<n)-1-i;
for(j=mm;j;j=(j-1)&mm)if(exist[j]&&f[i|j]>f[i]+1){
f[i|j]=f[i]+1;
p[i|j]=i;
pm[i|j]=j;
}
}
printf("%d\n",f[(1<<n)-1]);
vn=(1<<n)-1;
while(vn){
me=words[pm[vn]];
for(i=1;i<=an;i++)if(a[i].first==me){
cout<<a[i].second<<endl;
break;
}
// cout<<words[pm[vn]]<<endl;
vn=p[vn];
}
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8bWFwPgojaW5jbHVkZTxpb3N0cmVhbT4KI2luY2x1ZGU8Y3N0cmluZz4KI2luY2x1ZGU8bWVtb3J5Lmg+CiNpbmNsdWRlPGFsZ29yaXRobT4KdXNpbmcgbmFtZXNwYWNlIH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