#!/usr/bin/env python3 n = int(input()) f = [] for i in range(n): f += [input().split()] f = list(map(lambda *xs: xs, *f)) # transpose ans = [] for i in range(n): if f[i].count('nyanpass') == n-1: ans += [i] if len(ans) == 1: print(ans[0] + 1) else: print(-1)