#include #include struct Point { Point(int xx, int yy) { x = xx; y = yy; } int x, y; }; int main() { int n; while ( std::cin >> n ) { int c[30] = {}; int posx[30] = {}; int posy[30] ={}; int stlpec[30][30] = {}; bool johnFound = false; for ( int i=0; i > line; int riadok[30] = {0}; for ( unsigned int j=0;j 1 ) { posx[line[j] - 'A'] = i; posy[line[j] - 'A'] = j; johnFound = true; } if (!johnFound && riadok[ line[j] - 'A' ] > 1) { posx[line[j] - 'A'] = i; posy[line[j] - 'A'] = j; johnFound = true; } } } for ( int i = 0; i<27; i++ ) { if (c[i] == 1 || c[i] == n+1 ) std::cout << posx[i]+1 << " " << posy[i]+1 << " "; } for ( int i = 0; i<27; i++ ) { if (c[i] == n-1) std::cout << (char)(i + 'A') << std::endl; } } }