#include<stdio.h>
#include<cstring>
#include<algorithm>
using namespace std;

int k,d[250555],w[250555],rec[250555],adj[250555][33];
char s[55],sl[250555];
bool mark[250555];

void ubaci() {

    int x,l,i,y;

    x=0; l=strlen(s);
    for(i=0; i<l; i++) {
        y=s[i]-'a';
        if (adj[x][y]==0) {
            k++;
            sl[k]=s[i];
            adj[x][y]=k;
        }
        x=adj[x][y];
    }
    mark[x]=true;
    return;
}

void idar(int x) {

    int i,y,pb,pw,pq;

    if (mark[x]) {
        d[x]=2;
        w[x]=0;
        rec[x]=-1;
        return;
    }

    pb=1; pw=-1; pq=-1;
    for(i=0; i<30; i++) if (adj[x][i]) {
        y=adj[x][i];
        idar(y);
        if ( pb==1 ) {
            if (d[y]==2) {
                if ( w[y]>pw ) {
                    pw=w[y];
                    pq=y;
                }
            } else {
                pb=2;
                pw=w[y];
                pq=y;
            }
        } else {
            if (d[y]==1) {
                if ( w[y]<pw ) {
                    pw=w[y];
                    pq=y;
                }
            }
        }
    }

    d[x]=pb;
    w[x]=pw+1;
    rec[x]=pq;
    return;
}

int main() {

    FILE *ff = fopen("igra.in", "r"), *gg = fopen("igra.out", "w");

    int n,m,i,j,x;

    fscanf(ff,"%d", &n);

    m=n*50;
    for(i=0; i<m; i++) {
       mark[i]=false;
       for(j=0; j<30; j++) adj[i][j]=0;
    }

    k=0; sl[0]='~';
    for(i=0; i<n; i++) {
       fscanf(ff,"%s", &s);
       ubaci();
    }

    /*for(i=0; i<=k; i++) {
       if (mark[i]) printf("~");
       printf("%d (%c) : ", i, sl[i]);
       for(j=0; j<30; j++) if (adj[i][j]) {
           printf("%c ", 'a'+j);
       }
       printf("\n");
    }*/

    idar(0);

    if (d[0]==1) fprintf(gg,"%d\n", 2); else fprintf(gg,"%d\n", 1);

    x=rec[0];
    while(x!=-1) {
       fprintf(gg,"%c", sl[x]);
       x=rec[x];
    }
    fprintf(gg,"\n");

    fclose(ff); fclose(gg);
    return 0;
}
