#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cstring>

using namespace std;

#define maxN 5005
#define maxL 55

int minD = 200000000;
bool check;
int flg;


int n;
char dict[maxN][maxL];


struct node {
	char val;
	int flag;
	int d;
	bool lsr;
	
	node* son[27];	
};

node* newnode(char chr) {
	node* tmp = (node *)malloc(sizeof(node));
	(*tmp).val = chr; 
	(*tmp).flag = 0; 
	for (int i = 0; i < 26; i++)
		(*tmp).son[i] = NULL;	
	return tmp;	
}

node *root;

void init() {
	root = (node *)malloc(sizeof(node));
	(*root).val = '5'; 
	(*root).flag = 0; 
	for (int i = 0; i < 26; i++)
		(*root).son[i] = NULL;	
}

int ord(char chr) {
	return (chr - 'a');
}

void add (int kth) {
	node *pos = root;
	int idx = -1, len = strlen(dict[kth]);
	while ( ++idx < len ) 
		if ( (*pos).son[ord(dict[kth][idx])] == NULL ) {
			(*pos).son[ord(dict[kth][idx])] = newnode(dict[kth][idx]);
			pos = (*pos).son[ord(dict[kth][idx])];
			//(*pos).d = idx;
		}
		else {
			pos = (*pos).son[ord(dict[kth][idx])];	
			//(*pos).d = idx;
		}
	(*pos).flag = kth;
	(*pos).d = idx;
}
		
bool leaf(node *t) {
	bool ok = true;
	int idx = 0;
	while ( ( (*t).son[idx] == NULL ) && (idx < 26)) 
		idx++;	
	return (idx >= 26);
}
		
void dfs (node *pos) {
	if ( (*pos).flag ) 
		if ( (bool)(*pos).lsr == check ) 
			if ( (*pos).d < minD ) {
				minD = (*pos).d; 
				flg = (*pos).flag;
			}
	for (int i = 0; i < 26; i++)
		if ( (*pos).son[i] != NULL ) 
			dfs( (*pos).son[i] );	
}

bool solve ( node *pos, int depth ) {// cout << "DDDD " << endl;
	if ( leaf(pos) ) {
		(*pos).lsr = ( depth % 2 == 0 );
		(*pos).d = depth;
		return (*pos).lsr;
	}	
	
	bool lo;
	int idx = 0;
	if ( depth % 2 == 0 ) {
		lo = true;
		while ((idx < 26) && lo) 
			lo = lo && (solve((*pos).son[idx], depth+1)); 
	}
	else {
		lo = false;
		while ((idx < 26) && lo) 
			lo = lo || (solve((*pos).son[idx], depth+1)); 		
	}
	(*pos).lsr = lo;
	if ( (*pos).flag )
		(*pos).d = depth;
	return lo;	
}

void dfs2 (node *pos) { //cout << (*pos).flag << endl;
	if ( (*pos).flag > 0 ) 
		cout << (*pos).val << endl;
	for (int i = 0; i < 26; i++)
		if ( (*pos).son[i] != NULL ) 
			dfs( (*pos).son[i] );	
}
		
	
int main () {
    freopen("igra.in", "r", stdin);
    freopen("igra.out", "w", stdout);
    
    init();
    
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
    	scanf("%s", &dict[i]);
    	add(i);
	}
/*	for (int i = 0; i < 26; i++ )
	if ( (*root).son[i] != NULL ) cout << (*root).val << endl;
	*/
   /* 

    sort(dict, dict+n);

   // for (int i = 0; i < n; i++)
  // 		cout << dict[i].word << endl;
   		
	*/
/*   	char s1[] = "asd";
	char s2[] = "asda";
   	char s3[] = "ab";
   	add(s1);add(s2);
   	add(s3);
   	char s4[] = "sdada"; add(s4);
   	char s5[] = "dasfsewrwer"; add(s5);
   
*/   	
//cout << ord('z') << endl;
   	node *start = root;
  // 	dfs2(start);
	check = solve(start, 0);
	cout << check + 1 << endl;
   	dfs(root);		

   	cout << dict[flg] << endl;
   	
  // 	cout << minD << endl;
  /* 			
   	start = (*start).son[0];
   	for (int i = 0; i < 26; ++i)
   		if ( (*start).son[i] != NULL )
   			cout << i << endl;
	*/	   
		 	
       
    return 0;    
}
