import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); int N = Integer.parseInt(reader.readLine()); String[] inputs; int[][] table = new int[N][N]; for (int i = 0; i < N; i++) { inputs = reader.readLine().split(" "); for (int j = 0; j < N; j++) { if (inputs[j].equals("nyanpass")) { table[i][j] += 1; } } } int[] villagers = new int[N]; for (int i = 0; i < N; i++) { int counter = 0; for (int j = 0; j < N; j++) { if (table[j][i] == 1) { counter += 1; } } villagers[i] = counter; } int possibleNum = 0; int villagerId = -1; for (int i = 0; i < N; i++) { if (villagers[i] == N - 1) { possibleNum += 1; villagerId = i+1; } } if(possibleNum==1){ System.out.println(villagerId); } else { System.out.println(-1); } } }