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