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