package yukicorder; import java.util.Scanner; public class No239 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[][] murabito = new String[n][n]; int count = 0; int ans = -1; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ murabito[i][j] = sc.next(); } } for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(i==j||murabito[j][i].equals("nyanpass")){ if(j==n-1){ ans=i+1; count++; } continue; }else{ break; } } } if(count > 1){ ans = -1; } System.out.println(ans); } }