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

public class No00000239_Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		int[] cntArr = new int[n];
		for(int i = 0; i < n; i++) {
			String[] greetings = br.readLine().split(" ");
			for(int j = 0; j < n; j++) {
				if("nyanpass".equals(greetings[j])) cntArr[j] += 1;
			}
		}
		int result = -1;
		for(int k = 0; k < n; k++) {
			if(cntArr[k] == n - 1) {
				if(result == -1) {
					result = k + 1;
				} else {
					result = -1;
					break;
				}
			}
		}
		System.out.println(result);
	}
}