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

using namespace std;

const int N = 5005, L = 55;
struct rec_t { char s[L]; };
rec_t reci[N];
int len[N];

bool rec_lt(rec_t a, rec_t b)
{
 	 int i;
 	 for(i = 0; a.s[i] != 0 && a.s[i] == b.s[i]; i++) ;
 	 return a.s[i] < b.s[i];
}

/*
int dfs(int rec_s, int rec_e, int slovo)
{
 	printf("[%3i,%3i]:%3i\n",rec_s,rec_e,slovo);
 	if(rec_s == rec_e) return len[rec_s] - slovo;
 	int r = 1000, r2 = -1000;
 	for(int i = rec_s; i <= rec_e; i++)
 	{
	 		int s = rec_s;
	 		while(reci[i].s[slovo] == reci[s].s[slovo] && i <= rec_e) 
	 		{
			 					   if(len[i] == slovo + 1)
	   		 					   i++;
	        }
	 		i--;
	 		int x = dfs(s,i,slovo + 1);
		    if(slovo % 2 != x % 2 && x < r) r = x;
	 		else if(slovo % 2 == x % 2 && x < r2) r2 = -x;
	}
	if(r == 1000) return -r2;
	return r;
}
*/

/* struct cvor
{
 	   char slovo, dubina;
 	   int sledeci1, sledeci2;
};
cvor stablo[N*L];
int nn;

cvor ncvor(char s, char d, int s1, int s2) { cvor r; r.slovo = s; r.dubina = d; r.sledeci1 = s1; r.sledeci2 = s2; }

void napravi_stablo()
{
 	 nn = 0;
 	 queue<cvor> q;
 	 while(!q.empty())
 	 {
	  				  cvor x = q.front(); 
	  				  q.pop();
	  				  for(int i = x.sledeci1
	 }
}*/

// dfs(s,e,d): reci [s,e]; dubina d; vraca min. dodatnu dubinu
int dfs(int st, int en, int dubina, int *izb)
{
// 	printf("[%3i,%3i]:%3i\n",st,en,dubina);
	if(st == en)
	{
	 	  *izb = st;
	 	  return len[st] - dubina;
 	}
 	char c = reci[st].s[dubina];
 	int ns = st;
 	int izbmax,izbmin;
 	int min = 1000, max = -1000;
 	for(int i = st; i <= en; i++)
 	{
	 		if(dubina == len[i] - 1) 
		  			  { if(dubina < min) min = dubina; *izb = i; }
	 		if(reci[i].s[dubina] != c)
	 		{
			 					 if(c != '\0')
			 					 {
								  	  int tmp;
								  	  int x = dfs(ns, i - 1, dubina + 1, &tmp);
								  	  if(x % 2 == dubina % 2)
								  	  	   { if(x > max) max = x; izbmax = tmp;}
				  	  	   				   else if(x < min) { min = x; izbmin = tmp; }
				  	  	   				   
								 }
			 					 ns = i;
			 					 c = reci[i].s[dubina];
			}
    }
    if(min == 1000) { *izb = izbmax; return max; }
    else { *izb = izbmin; return min; }
}

int main(int argc, char *argv[])
{
 	freopen("igra.in","r",stdin);
 	freopen("igra.out","w",stdout);
 	int n;
 	scanf("%i",&n);
 	for(int i = 0; i < n; i++) 
	 		scanf(" %s",&reci[i].s);
 	sort(reci, reci + n, rec_lt);
	for(int i = 0; i < n; i++) len[i] = strlen(reci[i].s);
	int izb;
	int res = dfs(0,n-1,0,&izb);
	printf("%i\n",(res % 2 == 1) ? 1 : 2);
	printf("%s\n",reci[izb].s);
    return EXIT_SUCCESS;
}
