import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[][] list = new String[n][n]; int sum = 0; int id = -1; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { list[i][j] = sc.next(); } } IN:for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(i == j) continue; if(!list[j][i].equals("nyanpass")) continue IN; } sum++; id = i; } if(sum != 1) id = -2; System.out.println((id+1)); } }