import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Set<String> set = new HashSet<>();
		int N = Integer.parseInt(br.readLine());
		
		for (int line = 0; line < N; line++) {
			String str = br.readLine();
			if(!set.contains(str)) {
				set.add(str);
			}
			
			int len = str.length();
			char[] ch = str.toCharArray();
			for (int i = 0; i < len / 2; i++) {
				char temp = ch[i];
				ch[i] = ch[len - i -1];
				ch[len - i-1] = temp;
			}
			String reverse = String.valueOf(ch);
			if(set.contains(reverse)) {
				System.out.printf("%d %c",len,ch[len/2]);
			}
		}

	}
}