package yukicoder;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader read = new BufferedReader(new InputStreamReader(System.in));

		try {
			int N = Integer.parseInt(read.readLine());
			int[] count = new int[N];

			for (int i = 0; i < N; ++i) {
				String[] box = read.readLine().split(" ");

				for (int j = 0; j < N; ++j) {
					if (box[j].equals("nyanpass")) {
						count[j]++;
					}
				}
			}

			int ans = -1;
			for (int i = 0; i < N; ++i) {
				if (count[i] == N - 1) {
					if (ans == -1) {
						ans = i + 1;
					} else {
						ans = -1;
						break;
					}
				}
			}

			System.out.println(ans);

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}