import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); String[][] data = new String[N][N]; for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++){ data[i][j] = sc.next(); } } int count = 0, number = 0; LOOP: for(int j = 0; j < N; j++){ for(int i = 0; i < N; i++){ if(!"-".equals(data[i][j]) && !"nyanpass".equals(data[i][j])){ continue LOOP; } } number = j; count++; } System.out.println(count == 1 ? (number + 1) : -1); } }