#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)

int main(){
    string s;
    int n; cin >> n;
    vector<int>a(100);
    rep(i,n){
        rep(j,n){
            cin >> s;
            if(s=="nyanpass"){ a[j+1]++; }
        }
    }
    int res = 0;
    int cnt = 0;
    //rep(i,100){ cout << a[i] << endl;}
    rep(i,100){ if(a[i]==n-1){ cnt++; res = i; } }
    if(cnt>1){ cout << "-1" << endl; }
    else if(res!=0){ cout << res << endl; }
    else{ cout << "-1" << endl; }
    return 0;
}