import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); String temp = ""; int [][] B = new int[N][N]; for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { temp = scan.next(); if(temp.equals("nyanpass")) { B[i][j] = 1; }else { B[i][j] = 0; } } } scan.close(); int []cnt = new int[N]; Arrays.fill(cnt, 0); for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { if(B[j][i] == 1) { cnt[i] ++; } } } int k = 0; int ans = 0; for(int i = 0; i < N; i++) { if(cnt[i] == N - 1) { ans = i + 1; k ++; } } if(k > 1 || k == 0) { System.out.println("-1"); }else { System.out.println(ans); } } }