#include using namespace std; namespace { typedef double real; typedef long long ll; template ostream& operator<<(ostream& os, const vector& vs) { if (vs.empty()) return os << "[]"; os << "[" << vs[0]; for (int i = 1; i < vs.size(); i++) os << " " << vs[i]; return os << "]"; } template istream& operator>>(istream& is, vector& vs) { for (auto it = vs.begin(); it != vs.end(); it++) is >> *it; return is; } int N; vector> F; void input() { cin >> N; F = vector>(N, vector(N)); cin >> F; } void solve() { vector r; for (int j = 0; j < N; j++) { bool flag = true; for (int i = 0; i < N; i++) { if (i == j) continue; if (F[i][j] != "nyanpass") flag = false; } if (flag) { r.push_back(j); } } if (r.size() == 1) { cout << r[0] + 1 << endl; } else { cout << -1 << endl; } } } int main() { input(); solve(); return 0; }