//StdIn : 4 abc def fes cba
#include <stdio.h>
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
#define MAX 100
string reverse(string temp){
//cout<<" In function "<<temp;
char pwd[temp.length()];
int j=0;
for(int i=(temp.length())-1;i>=0;i--,j++){
pwd[j]=temp[i];
}
pwd[j]='\0';
string str(pwd);
return str;
}
int findPassword(string password[],int k){
string temp;
char *op;
unordered_map<string, string> ht;
for(int i=0;i<k;i++){
if(password[i].length()%2 == 0 ) {cout<<"error in length" ; return 0 ;}
temp=password[i];
ht.insert(make_pair(temp,reverse(temp)));
if(ht.find(reverse(temp))!=ht.end()){
//cout<<temp<< "<=>" <<reverse(temp)<<endl ;
cout<<password[i].length()<<" "<<temp[(password[i].length())/2];
return 1;
}//if
}//for
return 0;
}
int main(){
string password[MAX];
unordered_map<string, string> ht;
int i=0, j=0, k=0, t=0;
cin>>t;
k=t;
while(t){
cin>>password[i];
--t; ++i;
}
findPassword(password,k);
}//main
Ly9TdGRJbiA6IDQgYWJjIGRlZiBmZXMgY2JhCiNpbmNsdWRlIDxzdGRpby5oPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDx1bm9yZGVyZWRfbWFwPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBNQVggMTAwCnN0cmluZyByZXZlcnNlKHN0cmluZyB0ZW1wKXsKICAgIC8vY291dDw8IiBJbiBmdW5jdGlvbiAiPDx0ZW1wOwogICAgY2hhciBwd2RbdGVtcC5sZW5ndGgoKV07CiAgICBpbnQgaj0wOwogICAgZm9yKGludCBpPSh0ZW1wLmxlbmd0aCgpKS0xO2k+PTA7aS0tLGorKyl7CiAgICAgICAgcHdkW2pdPXRlbXBbaV07CiAgICB9CiAgICBwd2Rbal09J1wwJzsKICAgIHN0cmluZyBzdHIocHdkKTsKICAgIHJldHVybiBzdHI7Cn0KaW50IGZpbmRQYXNzd29yZChzdHJpbmcgcGFzc3dvcmRbXSxpbnQgayl7CiAgICBzdHJpbmcgdGVtcDsKICAgIGNoYXIgKm9wOwogICAgdW5vcmRlcmVkX21hcDxzdHJpbmcsIHN0cmluZz4gaHQ7CiAgICBmb3IoaW50IGk9MDtpPGs7aSsrKXsKICAgICAgICBpZihwYXNzd29yZFtpXS5sZW5ndGgoKSUyID09IDAgKSB7Y291dDw8ImVycm9yIGluIGxlbmd0aCIgOyByZXR1cm4gMCA7fSAgICAKICAgICAgICB0ZW1wPXBhc3N3b3JkW2ldOwogICAgICAgIGh0Lmluc2VydChtYWtlX3BhaXIodGVtcCxyZXZlcnNlKHRlbXApKSk7CiAgICAgICAgaWYoaHQuZmluZChyZXZlcnNlKHRlbXApKSE9aHQuZW5kKCkpewogICAgICAgICAgICAvL2NvdXQ8PHRlbXA8PCAiPD0+IiA8PHJldmVyc2UodGVtcCk8PGVuZGwgOwogICAgICAgICAgICBjb3V0PDxwYXNzd29yZFtpXS5sZW5ndGgoKTw8IiAiPDx0ZW1wWyhwYXNzd29yZFtpXS5sZW5ndGgoKSkvMl07CiAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgIH0vL2lmCiAgICB9Ly9mb3IKICAgIHJldHVybiAwOwp9CmludCBtYWluKCl7CgogICAgc3RyaW5nIHBhc3N3b3JkW01BWF07CiAgICB1bm9yZGVyZWRfbWFwPHN0cmluZywgc3RyaW5nPiBodDsKCiAgICBpbnQgaT0wLCBqPTAsIGs9MCwgdD0wOwogICAgY2luPj50OwogICAgaz10OwogICAgd2hpbGUodCl7CiAgICAgICAgY2luPj5wYXNzd29yZFtpXTsKICAgICAgICAtLXQ7ICsraTsKICAgIH0KICAgIGZpbmRQYXNzd29yZChwYXNzd29yZCxrKTsKICAgIAp9Ly9tYWlu