import java.util.Scanner; public class No_239 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); String[][] greetingList = new String[a][a]; for (int i = 0; i < greetingList.length; i++) { for (int j = 0; j < greetingList.length; j++) { greetingList[i][j] = sc.next(); } } int sum = 0; int renchonNumber = 0; boolean renchon = false; Loop: for (int i = 0; i < greetingList.length; i++) { for (int j = 0; j < greetingList.length; j++) { if (i == j) { continue; } if (!greetingList[j][i].equals("nyanpass")) { continue Loop; } } sum++; renchonNumber = i + 1; renchon = true; if (sum > 1) { renchon = false; break; } } if (renchon) { System.out.println(renchonNumber); } else { System.out.println(-1); } } }