# coding=utf-8: import collections n = int(input()) persons = dict([(i, 0) for i in range(n)]) greeting = list() for i in range(n): greeting.append(list(map(str, input().split()))) for j in range(n): for k in range(n): if greeting[j][k] == "nyanpass": persons[k] += 1 max_k = [k for k, v in persons.items() if v == max(persons.values())] print(max_k) if len(max_k) == 1 and persons[max_k]+1 == n: print(max_k[0]+1) else: print(-1)