#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef vector vll; typedef vector vi; typedef vector> vvi; typedef vector> vvll; const ll inf = 1e16; const ll md = 1000000007; string t[105][105]; int main() { int n; cin >> n; rep(i, n) rep(j, n) cin >> t[i][j]; int ans = -1; rep(j, n) { bool flag = false; rep(i, n) { if(i==j) continue; if (t[i][j] != "nyanpass") { flag = true; break; } } if (flag) continue; if (ans == -1) ans = j; else ans = -2; } if (ans < 0) puts("-1"); else cout << ans+1 << endl; return 0; }