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