#include #include #include #include #include #include #include #include #include using namespace std; void findMis(const vector& vzor, const vector& chybny){ size_t poc = vzor.size(); for (size_t i = 0; i < poc; i++){ if ( find (vzor.begin(), vzor.end(), chybny[i]) == vzor.end()){ cout< a; vector b; vector c; vector a1; vector b1; vector c1; vector vzor; getchar(); for (int j = 0; j < poc; j++) { a.push_back(getchar()); } getchar(); for (int j = 0; j < poc; j++) { b.push_back(getchar()); } getchar(); for (int j = 0; j < poc; j++) { c.push_back(getchar()); } getchar(); a1 = a; b1 = b; c1 = c; sort(a.begin(), a.end()); sort(b.begin(), b.end()); sort(c.begin(), c.end()); if (a == b && a == c) { vzor = a1; bool done = false; for (int i = 3; i < poc; i++) { string radka = ""; getline(cin, radka); if (!done) { stringstream t(radka); char q; int cnt = 0; bool isOk = true; for (int l = 0; l < poc; l++) { t>>q; cnt++; if (find(vzor.begin(), vzor.end(), q) == vzor.end()) { isOk = false; break; } } if (isOk) continue; cout << i + 1 << " " << cnt << " "; for (int l = 0; l < poc; l++) { bool found = false; for (int fn = 0; fn < poc; fn++) { if (vzor[l] == radka[fn]) { found = true; break; } } if (!found) { cout << (char) vzor[l] << endl; done = true; } } } } } else { if (a != b && a == c) { cout<<2<<" "; findMis(c1, b1); for (int i = 3; i < poc; i++) { string radka = ""; getline(cin, radka); } } else if (a != b) { cout<<1<<" "; findMis(c1, a1); for (int i = 3; i < poc; i++) { string radka = ""; getline(cin, radka); } } else { cout<<3<<" "; findMis(a1, c1); for (int i = 3; i < poc; i++) { string radka = ""; getline(cin, radka); } } } } /* * */ int main(int argc, char** argv) { int poc; while (!feof(stdin) && cin >> poc) { func(poc); } return 0; }