#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; vector > A( N + 1 , list() ); for( ll i = 1 ; i <= N ; i++ ){ for( ll j = 1 ; j <= N ; j++ ){ cin >> a; A[j].push_back( a ); } } const string h = "-"; const string n = "nyanpass"; ll answer = 0; for( ll j = 1 ; j <= N && answer != -1 ; j++ ){ const list& Aj = A[j]; bool poi = true; for( auto itr = Aj.begin() , end = Aj.end() ; itr != end && poi ; itr++ ){ const string& Aij = *itr; if( Aij != h && Aij != n ){ poi = false; } } if( poi ){ if( answer == 0 ){ answer = j; } else { answer = -1; } } } if( answer == 0 ){ answer = -1; } cout << answer << endl; return 0; }