// #define _GLIBCXX_DEBUG #include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) int main() { // Input int N; cin >> N; vector> A(N, vector(N)); rep(i, N) rep(j, N) cin >> A[i][j]; // Judge const string key = "nyanpass"; int cnt = 0; int idx; rep(j, N) { bool isRenchon = true; rep(i, N) if (i != j && A[i][j] != key) isRenchon = false; if (isRenchon) ++cnt, idx = j + 1; } // Output cout << (cnt == 1 ? idx : -1) << endl; }