#include #include #include using namespace std; int main() { int n; while (cin >> n) { int right, right2, t; string s[26]; for (int i = 0; i < n; ++i) { cin >> s[i]; } int size = s[0].length(); string sorted[26]; for (int i = 0; i < n; ++i) { sorted[i] = s[i]; } for (int i = 0; i < n; ++i) { sort(sorted[i].begin(), sorted[i].end()); } if (sorted[0] != sorted[1]) { if (sorted[0] != sorted[2]) right = 0; else right = 1; } else for (int i = 1; i < n; ++i) { if (sorted[0] != sorted[i]) { right = i; break; } } if (right == 0) t = 1; else t = 0; char missing; for (int i = 0; i < size; ++i) { if (s[t].find(s[right][i]) == std::string::npos) { right2 = i; } } for (int i = 0; i < size; ++i) { if (s[right].find(s[t][i]) == std::string::npos) { missing = s[t][i]; } } cout << right + 1 << " " << right2 + 1 << " " << missing << endl; } }