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

#define pii pair<int,int>
#define pis pair<int,string>
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define MaxN 5010
#define MaxLen 55

class Trie {
public:

    char c;
    int size;
    Trie *a[26];
    bool mark[26];
    int end;
    bool pob;
    string pobS;
    int len;

    Trie() {
        size = 0;
        memset(mark, 0, sizeof(mark));
        end = 0;
    }

    void init() {
        size = 0;
        memset(mark, 0, sizeof(mark));
        end = 0;
        pobS = "";
    }

    static bool cmp( Trie *p1, Trie *p2 ) {
        return p1->c < p2->c;
    }

    void add( int p, char *s, int len )
    {
        //printf("%d %s %d\n",p,s,len);
        //for (int i = 0; i < size; ++i) {
        //    printf("%c %d %c\n",a[i]->c,mark[ a[i]->c-'a' ],s[p]);
        //}

        if ( p == len ) {
            end++;
            return;
        }

        if ( mark[ s[p]-'a' ] ) {
            for (int i = 0; i < size; ++i) {
                if ( a[i]->c == s[p] ) {
                    a[i]->add( p+1, s, len );
                    break;
                }
            }
        }
        else {
            Trie *pok = new Trie;
            a[ size++ ] = pok;
            mark[ s[p]-'a' ] = true;

            a[ size-1 ]->init();
            a[ size-1 ]->c = s[p];
            a[ size-1 ]->add( p+1, s, len );

        }
    }

    void Sort()
    {
        for (int i = 0; i < size; ++i)
            a[i]->Sort();
        sort( a, a+size, cmp );
    }

    int Solve()
    {
        pobS = "";
        pob = false;
        len = 100;
        int id = -1;

        if ( end == 0 ) {
            for (int i = 0; i < size; ++i) {
                a[i]->Solve();

                //printf("%c %d %c %d %d\n",c,i,a[i]->c,a[i]->pob,a[i]->len);

                if ( !a[i]->pob ) {
                   pob = true;

                   if ( len > a[i]->len ) {
                      id = i;
                      len = a[i]->len;
                   }
                }
                else {
                    if ( pob ) continue;

                    if ( len < a[i]->len || id == -1 ) {
                        id = i;
                        len = a[i]->len;
                    }
                }
            }
        }

        //printf("%c %d\n",c,id);

        if ( id != -1 ) {
            pobS = a[id]->c;
            pobS += a[id]->pobS;
            len++;
        }
        else {
            if ( size == 0 || end > 0 ) {
                pob = true;
                len = 1;
            }
            else {
                len = 100;
            }
        }
    }


};

char s[MaxLen];
int n;
Trie trie;

int main()
{
    freopen("igra.in","r",stdin);
    freopen("igra.out","w",stdout);

    trie.init();

    scanf("%d",&n);
    for (int i = 0; i < n; ++i) {
        scanf("%s",s);
        trie.add( 0, s, strlen(s) );
    }
    trie.Sort();
    trie.Solve();

    printf("%d\n%s\n",2-trie.pob,trie.pobS.c_str());

    return 0;
}
