#include using namespace std; int readone(){ int n, res = 0; cin >> n; while(n){ res |= 1<<(n%10); n /= 10; } return res; } int main(){ int n; while(scanf("%d", &n) == 1){ vector data; int frq[30];memset(frq, 0, sizeof(frq)); for(int i = 0; i < n; i++){ string a; cin >> a; for(int j = 0; j < n; j++){ frq[a[j]-'A'] ++; } data.push_back(a); } char bad, correct; bool twice = false; for(int i = 0; i < 26; i++){ if(frq[i] == 1 ) bad = i + 'A'; if(frq[i] == n+1){ bad = i + 'A'; twice = true; } if(frq[i] == n - 1) correct = i + 'A'; } if(twice){ int fir = -1, sec; for(int i = 0; i < n; i++){ fir = -1; for(int j = 0; j < n; j++){ if(data[i][j] == bad){ if( fir == -1 ){ fir = j; } else { sec = j; int fitmp = 0, setmp = 0; for(int k = 0; k < n; k++){ if(data[k][fir] == bad) fitmp ++; if(data[k][sec] == bad) setmp ++; } if(fitmp == 2){ i ++; fir ++; cout << i << ' ' << fir << ' ' << correct << endl; } else { i ++; sec ++; cout << i << ' ' << sec << ' ' << correct << endl; } goto nextIter; } } } } } else { for(int i = 0; i < n; i++) for(int j = 0; j < n; j++){ if(data[i][j] == bad){ i++; j++; cout << i << ' ' << j << ' ' << correct << endl; goto nextIter; } } } nextIter: ; } }