using System;
using System.Linq;
using System.Collections.Generic;

class No239{
    static void Main(){
        var n=Int32.Parse(Console.ReadLine());
        var a=0;
        int[] c=new int[n];
        for(int i=0;i<n;++i){
            var b=Console.ReadLine().Split(' ');
            for(int j=0;j<n;++j){
                if(b[j]=="nyanpass"){
                    c[j]++;
                    if(c[j]==n-1){
                        if(a==0){
                            a=j+1;
                        }
                        else{
                            a=-1;
                            break;
                        }
                    }
                }
            }
        }
        Console.WriteLine((a!=0)?a:-1);
    }
}