import java.io.*; import java.util.*; public class Exercise64{ public static void main (String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String num = new String(in.readLine()); int n = Integer.parseInt(num); String[][] greetings = new String[n][n]; for(int i = 0; i < n; i++){ String str = new String(in.readLine()); String[] strArray = str.split(" "); greetings[i] = strArray; } LinkedList answer = new LinkedList(); for(int a = 0; a < n; a++){ boolean flag = true; for(int b = 0; b < n; b++){ if (!greetings[b][a].equals("nyanpass") && !greetings[b][a].equals("-")){ flag = false; } } if (flag){ answer.add(a + 1); } } if (answer.size() == 1){ System.out.println(answer.get(0)); }else{ System.out.println(-1); } } }