#include #include #include using namespace std; int main ( ) { int n, counter[26]; char result, wrong, string[30][30]; while(scanf("%d\n", &n) == 1) { memset(counter, 0, 26*sizeof(int)); for(int i = 0; i < n; ++i) { fgets(string[i],n+2,stdin); for (int j = 0; j < n; ++j) counter [ string[i][j] - 'A' ]++; } for ( int i = 0; i < 26; ++i ) if ( counter [ i ] == n-1 ) { result = 'A'+i; } bool simpleCase; for ( int i = 0; i < 26; ++i ) if ( counter [ i ] == n+1 ) { wrong = 'A'+i; simpleCase = false; } else if ( counter [ i ] == 1 ) { wrong = 'A'+i; simpleCase = true; } int x, y, cnt = 0; if ( simpleCase ) { for ( int i = 0; i < n; ++i ) for ( int j = 0; j < n; ++j ) { if ( string[i][j] == wrong ) { x = i + 1; y = j + 1; } } } else { for ( int i = 0; i < n && cnt < 2; ++i ) { cnt = 0; for ( int j = 0; j < n && cnt < 2; ++j ) { if ( string[i][j] == wrong ) cnt++; if ( cnt == 2 ) x = i + 1; } } cnt = 0; for ( int i = 0; i < n && cnt < 2; ++i ) { cnt = 0; for ( int j = 0; j < n && cnt < 2; ++j ) { if ( string[j][i] == wrong ) cnt++; if ( cnt == 2 ) y = i + 1; } } } printf ( "%d %d %c\n", x, y, result ); } return 0; }