package yukicoder; import java.util.Scanner; public class yuki239 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int count = scan.nextInt(); String[][] strArr = new String [count][count]; int[][] intFlg = new int[count][count]; int ans = 0; int ans3 = 0; Boolean ans_flg = false; for (int i = 0; i < count; i++) { for (int j = 0; j < count; j++) { strArr[i][j] = scan.next(); } } for (int i = 0; i < count; i++) { for (int j = 0; j < count; j++) { if ("nyanpass".equals(strArr[j][i])){ intFlg[i][j] = 3; } else if("-".equals(strArr[j][i]) ){ intFlg[i][j] = 2; } else{ intFlg[i][j] = 1; } } } for (int i = 0; i < count; i++) { for (int j = 0; j < count; j++) { if(intFlg[i][j] == 3){ ans += 3; } else if (intFlg[i][j] == 2){ ans += 2; } else { ans = -1; } } if(ans >= 7 && ans_flg == false){ ans3 = i + 1; ans_flg = true; } else if(ans >= 7 && ans_flg == true){ ans3 = -1; break; } ans = 0; } if(ans_flg == true){ System.out.print(ans3); }else { System.out.print(-1); } scan.close(); } }