import java.util.Scanner; public class Yukicoder239 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), res = -1; int cnt[] = new int[n]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) if (sc.next().equals("nyanpass")) cnt[j]++; for (int j = 0; j < n; j++) { if (cnt[j] == n-1) { if (res == -1) { res = j + 1; } else { res = -1; break; } } } System.out.println(res); } }