n=int(input()) ans=[0]*n;f_ans=[] for i in range(n): s=input().split() for j in range(len(s)): if s[j]=='nyanpass' or s[j]=='-': ans[j]+=1 for i in range(len(ans)): if ans[i]==n: f_ans.append(i) if len(f_ans)==1: print(f_ans[0]+1) else: print(-1)