#include #include #include #include const std::string n = "nyanpass"; int main() { int people; std::cin >> people; std::vector nyanpas_count(people, 0); for (int i = 0; i < people; i++) { for (int j = 0; j < people; j++) { std::string str; std::cin >> str; if (str == n){ nyanpas_count[j]++; } } } int max = *std::max_element(nyanpas_count.begin(), nyanpas_count.end()); if (max == 0 || max != people - 1 || std::count(nyanpas_count.begin(), nyanpas_count.end(), max) > 1) { std::cout << -1 << std::endl; } else { for (size_t i = 0; i < nyanpas_count.size(); i++) { if (nyanpas_count[i] == max) { std::cout << i + 1 << std::endl; break; } } } return 0; }