#include #include #include using namespace std; using ll = long long; int main() { char A[31], Sample[] = "nyanpass"; int n, Match[100] = { 0 }; scanf("%d", &n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { scanf("%s", A); if (i == j) continue; bool str_match = true; for (int i = 0; i < 9; i++) str_match &= A[i] == Sample[i]; Match[j] += str_match; } } int match_id, match_count = 0; for (int i = 0; i < n; i++) if (Match[i] == n - 1) match_count++, match_id = i; if (match_count != 1) printf("-1\n"); else printf("%d\n", match_id + 1); }