#include #include #include #include #include #include #include #include #include #include #include #include #define FOR(i, a, b) for(int i=(a);i<=(b);i++) #define RFOR(i, a, b) for(int i=(a);i>=(b);i--) #define MOD 1000000007 #define INF 1000000000 using namespace std; int main(void) { int n; char a[101][101][31]; int count = 0; int point = -1; cin >> n; FOR(i, 1, n) { FOR(t, 1, n) { cin >> a[i][t]; } } FOR(i, 1, n) { FOR(t, 1, n) { if (i == t) { if (i == t + 1) { point = i; count++; } continue; } if (strcmp("nyanpass", a[t][i]) != 0) { break; } if (t == n) { point = i; count++; } } } if (count == 1) { cout << point << endl; } else { cout << -1 << endl; } return 0; }