/*
    Aleksandar "Al3kSaNdaR" Ivanovic

    igra
*/
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

const int MaxN = 5000 + 5;
const int MaxLen = 50 + 5;

typedef struct Word
{
    int Len;

    char Letters[MaxLen];

    Word ( void )
    {
        Len = 0;
    }
};

inline bool Compare ( const Word & First, const Word & Second )
{
    if ( First.Len < Second.Len ) return true;
    if ( First.Len > Second.Len ) return false;

    for ( int i = 0; i < First.Len; i++ )
    {
        if ( First.Letters[i] < Second.Letters[i] ) return true;
        if ( First.Letters[i] > Second.Letters[i] ) return false;
    }

    return false;
}

inline bool CompareLex ( const Word & First, const Word & Second )
{
    int Len;

    if ( First.Len < Second.Len ) Len = First.Len;
    else Len = Second.Len;

    for ( int i = 0; i < Len; i++ )
    {
        if ( First.Letters[i] < Second.Letters[i] ) return true;
        if ( First.Letters[i] > Second.Letters[i] ) return false;
    }

    if ( First.Len < Second.Len ) return true;
    else return false;
}

int N;

Word Words[MaxN];

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

    scanf ( "%d", &N );

    for ( int i = 0; i < N; i++ )
    {
        scanf ( " %s", Words[i].Letters );

        Words[i].Len = strlen ( Words[i].Letters );
    }

    sort ( Words, Words + N, CompareLex );

    int idx;

    idx = 0;

    Words[idx++] = Words[0];

    Word SubWord = Words[0];

    for ( int i = 1; i < N; i++ )
    {
        bool Ok = true;

        for ( int j = 0; j < SubWord.Len; j++ ) Ok &= ( Words[i].Letters[j] == SubWord.Letters[j] );

        if ( ! Ok )
        {
            SubWord = Words[i];

            Words[idx++] = SubWord;
        }
    }

    N = idx;
printf("%d\n",N);
    sort ( Words, Words + N, Compare );

    idx = -1;

    for ( int i = 0; i < N; i++ ) if ( ( Words[i].Len % 2 ) == 0 )
                                  {
                                      idx = i;

                                      break;
                                  }

    if ( idx == -1 )
    {
        printf ( "2\n" );

        printf ( "%s\n", Words[0].Letters );

        return 0;
    }

    Word CurrWord;

    CurrWord.Len = 1;
    CurrWord.Letters[0] = Words[idx].Letters[0];

    int Player = 2;

    int NumberOfIterations = 50;

    while ( NumberOfIterations-- )
    {
        idx = -1;

        for ( int i = 0; i < N; i++ )
        {
            bool Ok = true;

            for ( int j = 0; j < CurrWord.Len; j++ ) Ok &= ( Words[i].Letters[j] == CurrWord.Letters[j] );

            if ( ! Ok ) continue;

            if ( CurrWord.Len == Words[i].Len ) continue;

            if ( ( Player == 1 ) && ( ( Words[i].Len % 2 ) == 1 ) ) continue;
            if ( ( Player == 2 ) && ( ( Words[i].Len % 2 ) == 0 ) ) continue;

            idx = i;

            CurrWord.Len++;
            CurrWord.Letters[CurrWord.Len - 1] = Words[i].Letters[CurrWord.Len - 1];

            break;
        }

        if ( idx == -1 )
        {
            int OppIdx = -1;

            for ( int i = 0; i < N; i++ )
            {
                bool Ok = true;

                for ( int j = 0; j < CurrWord.Len; j++ ) Ok &= ( Words[i].Letters[j] == CurrWord.Letters[j] );

                if ( ! Ok ) continue;

                if ( CurrWord.Len == Words[i].Len ) continue;

                if ( ( Player == 1 ) && ( ( Words[i].Len % 2 ) == 0 ) ) continue;
                if ( ( Player == 2 ) && ( ( Words[i].Len % 2 ) == 1 ) ) continue;

                OppIdx = i;

                CurrWord.Len++;
                CurrWord.Letters[CurrWord.Len - 1] = Words[i].Letters[CurrWord.Len - 1];

                break;
            }

            printf ( "%d\n%s\n", ( Player % 2 ) + 1, Words[OppIdx].Letters );

            return 0;
        }

        Player = ( Player % 2 ) + 1;
    }

    return 0;
}
