#include using namespace std; string t = "nyanpass"; int n; int cnt[100]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ string s; cin >> s; if (s == t) cnt[j]++; } } int q = 0, r = -1; for (int i = 0; i < n; i++){ if (cnt[i] == n - 1){ q++; r = i; } } if (q != 1) puts("-1"); else printf("%d\n", r + 1); }