#include #include #include #include #include #include using namespace std; using uint = unsigned int; using ll = long long; #define CIN( LL , A ) LL A; cin >> A #define GETLINE( A ) string A; getline( cin , A ) int main() { CIN( ll , N ); string a; const string n = "nyanpass"; vector b( N + 1 , 1 ); ll num = N; for( ll i = 1 ; i <= N ; i++ ){ for( ll j = 1 ; j <= N ; j++ ){ cin >> a; char& bj = b[j]; if( bj == 1 ){ if( i != j ){ if( a != n ){ bj = 0; num--; } } } } } if( num == 1 ){ for( ll j = 1 ; j <= N ; j++ ){ if( b[j] == 1 ){ cout << j << endl; return 0; } } } else { cout << -1 << endl; } return 0; }