N=int(input()) B=[1]*N C=range(N) for i in C: A=input().split() for j in C: if A[j]!='nyanpass' and A[j]!='-':B[j]=0 O=-1 if sum(B)==1:O=B.index(1)+1 print(O)