N = int(input()) x = [0] * N for i in range(N): A = input().split() for j in range(N): if A[j] == 'nyanpass': x[j] += 1 if len([a for a in x if a == (N-1)]) == 1: print(x.index(N-1) + 1) else: print(-1)