n = int(input()) cnt = [0] * n for i in range(n): s = input().split() for j, k in enumerate(s): if k == 'nyanpass': cnt[j] += 1 if cnt.count(n - 1) != 1: print(-1) else: print(cnt.index(n - 1) + 1)