i=int(input()) l=[0]*i for j in range(i): for k,e in enumerate(input().split()): if e=="nyanpass":l[k]+=1 print(-1 if l.count(max(l))!=1 or max(l)!=i-1 else l.index(max(l))+1)