#include using namespace std; signed main(){ int N; cin >> N; vector< vector< string > > mat( N, vector< string >( N ) ); for( int i = 0; i < N; ++i ) for( int j = 0; j < N; ++j ) cin >> mat[ i ][ j ]; int ans = -1; for( int j = 0; j < N; ++j ){ int ng = 0; for( int i = 0; i < N; ++i ) if( i != j ) ng |= mat[ i ][ j ] != "nyanpass"; if( not ng ){ if( ans != -1 ) cout << -1 << endl, exit( 0 ); else ans = j + 1; } } cout << ans << endl; return 0; }