#include using namespace std; using ll = long long; const ll mod = 1e9 + 7; const ll inf = (1 << 30) - 1; const ll infll = (1LL << 61) - 1; int N, cnt, ans, mp[111]; string a[111][111]; int main() { cin >> N; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { cin >> a[i][j]; mp[j] += a[i][j] == "nyanpass"; if (i != j && mp[j] == N - 1) cnt++, ans = j + 1; } } cout << ((cnt - 1) ? ans : -1) << endl; }