#include #include #include #define map unordered_map #define set unordered_set using namespace std; int main(int argc, char **argv) { int rowC; while (cin >> rowC) { string row; char best = -1; map found; map x; map y; for (int i=0; i> row; for (string::size_type j = 0; j < row.length(); ++j) { if (found.find(row[j]) == found.end()) { y[row[j]] = i+1; x[row[j]] = j+1; found[row[j]] = 1; } else { ++ found[row[j]]; } } } int rx,ry; for (auto bf = found.begin(); bf != found.end(); ++bf) { //printf("%c %d\n", bf->first, bf->second); if (bf->second == rowC-1) { best = bf->first; } if (bf->second == 1) { rx = x[bf->first]; ry = y[bf->first]; } } printf("%d %d %c\n", ry, rx, best); } return 0; }