n=int(input()) a=[input().split() for i in range(n)] ans=[] for i in range(n): f=1 for j in range(n): if i!=j: if a[j][i]!='nyapass': f=0 if f==1: ans.append(i) if len(ans)==1: print(ans[0]+1) else: print(-1)