#include #include #include #include using namespace std; int main() { int n; cin >> n; string s[n][n]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> s[i][j]; string t = "nyanpass"; bool f[110] = {}; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i == j) continue; if (s[i][j] != t) f[j] = true; } } int a, cnt = 0; for (int i = 0; i < n; i++) if (!f[i]) cnt++, a = i + 1; cout << (cnt == 1 ? a : -1) << endl; return 0; }