import java.io.BufferedReader; import java.io.InputStreamReader; public class No239 { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader( System.in)); int N = Integer.parseInt(br.readLine()); String[][] a = new String[N][N]; for (int i = 0; i < N; i++) { a[i] = br.readLine().split(" "); } // にゃんパスカウンター int count[] = new int[N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (a[i][j].equals("nyanpass")) { count[j]++; } } } int num = -1; for (int i = 0; i < N; i++) { if (count[i] == N - 1) { if (num == -1) { num = i + 1; } else { num = -1; break; } } } System.out.println(num); } catch (Exception e) { e.printStackTrace(); System.err.println("Error:" + e.getMessage()); } } }