import java.util.Scanner; import java.util.ArrayList; class solve { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); String a[][] = new String[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { a[i][j] = scan.next(); } } ArrayList ans = new ArrayList(); for (int i = 0; i < n; i++) { boolean ok = true; for (int j = 0; j < n; j++) { if (i == j) continue; if (!a[j][i].equals("nyanpass")) { ok = false; break; } } if (ok) { ans.add(i+1); } } if (ans.size() == 1) { System.out.println(ans.get(0)); }else { System.out.println("-1"); } } }