N = int(input()) ck = [0 for i in range(100)] for i in range(N): l = list(map(str, input().split())) for i in range(N): if l[i] == "nyanpass": ck[i] += 1 if ck.count(N-1) > 1: print("-1") else: print(ck.index(N-1)+1)