package me.yukicoder.lv1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No0239 { public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { int N = Integer.parseInt(br.readLine()); String[][] greet = new String[N][N]; int ans = -1; for (int i = 0; i < N; i++) { String[] str = br.readLine().split(" "); for (int j = 0; j < N; j++) { greet[i][j] = str[j]; } } for (int j = 0; j < N; j++) { int cnt = 0; for (int i = 0; i < N; i++) { if (i != j) { cnt = greet[i][j].equals("nyanpass") ? cnt + 1 : cnt; } } if (cnt == N - 1) { if (ans == -1) { ans = j + 1; } else { ans = -1; } } } System.out.println(ans); } catch (IOException e) { e.printStackTrace(); } } }