r=range N=int(input()) A=[1]*N for _ in r(N): B=input().split() for i in r(N):A[i]*=(B[i]=='nyanpass' or B[i]=='-') print(A.index(1)+1 if A.count(1)==1 else -1)