#include using namespace std; int main(void) { int i, j, k, ans = 0, hu = 0, n, m = 0, pa[105] = { 0 }; char a[105][105][33], h[10] = "nyanpass"; cin >> n; for (j = 1; j <= n; j++) { for (i = 1; i <= n; i++) { cin >> a[j][i]; m = 0; for (k = 0; k < 9; k++) { if (a[j][i][k] == h[k]) m++; else break; if (m == 9) pa[i]++; } } } for (int min = n - 1;min>0; min--) { for (i = 1; i <= n; i++) { if (min == pa[i]) { ans = i; hu++; } } if (hu > 0)break; } if (hu != 1)ans = -1; cout << ans << endl; return 0; }