n = int(input()) renchon = "nyanpass" tab = [0 for _ in range(n)] for _ in range(n): sli = input().split() for i in range(n): if sli[i] == renchon: tab[i] += 1 res = max(tab) if res == 0: print(-1) else: print((tab.index(res) + 1) if tab.count(res) == 1 else -1)