import java.util.*; public class Run { public static void main (String arg[]) { Scanner scan = new Scanner(System.in); int ans = -1; int N = scan.nextInt(); String A; boolean b [] = new boolean[N]; int flag = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { A = scan.next(); if (i==j) continue; if (!b[j]) { if (!A.equals("nyanpass")) { b[j] = true; } } } } for (int i = 0; i < N; i++) { if (!b[i]) { if (flag!=0) break; flag = i+1; } if (i==N-1 && flag!=0) ans = flag; } System.out.println(ans); } }