#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef complex P; typedef pair pii; #define REP(i,n) for(ll i=0;i> n; vector flag(n,true); string renchon = "nyanpass"; REP(i,n){ REP(j,n){ string s; cin >> s; if(i==j)continue; if(s!=renchon)flag[j]=false; } } int pasu = -2; REP(i,n){ if(pasu==-2 && flag[i])pasu = i; else if(flag[i]){ pasu = -2; break; } } cout << pasu+1 << endl; return 0; }