#include #include #include using namespace std; int main(){ int n; cin >> n; vector data; data.resize(n,0); int check = -1; /* for(auto &a:data){ cin >> a; } for(int i = 0; i < n+1; i++){ if(i % (n+1) == 0) continue; if(data[i] == "nyanpass"){ int count = 1; for(int j = i + n; j < n * n; j += n){ if(data[j] == "nyanpass") count++; if(count == n - 1){ (check == -1) ? (check = (i%n)+1) : (check = -2); } if(check == -2){ check = -1; break; } } } } */ for(int i = 0;i < n; i++){ for(int j = 0; j < n; j++){ string s; cin >> s; if(i == j) continue; if(s == "nyanpass") data[j] = 1; else data[j] = 0; } } int count = 0; for(int j = 0; j < n; j++){ if(data[j]){ count++; check = j + 1; } } if( count != 1 ) check = -1; cout << check << endl; return 0; }