import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt( sc.nextLine() ); int [] count = new int [N]; for(int i=0; i<N; i++){ String tem = sc.nextLine(); String [] arr = tem.split(" "); for(int j=0; j<N; j++){ if( "nyanpass".equals(arr[j]) ){ count[j]++; } } } int f = 0; for(int i=0; i<N; i++){ if(count[i]==N-1){ f++; } } if(f!=1){ System.out.println(-1); }else{ for(int i=0; i<N; i++){ if(count[i]==N-1){ System.out.println(i+1); break; } } } } }