package m.shin; import java.util.Scanner; public class Con239 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(); int[] count = new int[N]; for(int i = 0;i < N;i++){ for(int k = 0;k < N;k++){ if(s.next().equals("nyanpass")){ count[k]++; } } } s.close(); int ft = -1 , answer = -1; for(int i = 0;i < N;i++){ if(count[i] == N-1 && ft == -1){ ft = 1; answer = i+1; }else if(count[i] == N-1 && ft != -1){ ft = 0; } } if(ft == 1){ System.out.println(answer); }else{ System.out.println(-1); } } }