n=int(input()) a=[list(input().split()) for _ in range(n)] j=[0]*n for y in range(n): for x in range(n): if a[y][x]=='nyanpass': j[x]+=1 if j.count(n-1)!=1: print(-1) else: print(j.index(n-1)+1)