#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <cmath>
#include <functional>
using namespace std;
#define diff(x,y) ((x > y) ? (x - y) : (y - x))
#define us(x) (x > 0) ? x : x * -1
#define lli long long int

int main() {
	int n;
	string str;
	cin >> n;
	vector <pair<int, int>> v(n);
	for (int i = 0; i < n; i++) {
		v[i].first = 0;
		v[i].second = i + 1;
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> str;
			if (str == "nyanpass")
				v[j].first++;
		}
	}
	sort(v.begin(), v.end());
	if (v[n - 1].first == n - 1 && v[n - 2].first != n - 1)
		cout << v[n - 1].second << endl;
	else
		cout << -1 << endl;
	return 0;
}