import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[][] a = new String[n][n]; for(int i = 0 ; i < n ; i++) { for(int j = 0 ; j < n ; j++) { a[i][j] = sc.next(); } } int ret = 0; int cnt1 = 0; for(int i = 0 ; i < n ; i++) { int cnt = 0; for(int j = 0 ; j < n ; j++) { if(a[j][i].equals("nyanpass")) { cnt++; } if(cnt == n - 1) { cnt1++; ret = i + 1; break; } } } if(cnt1 == 1) { System.out.println(ret); } else { System.out.println(-1); } } }