def main(): N = int(input()) B = [input().split() for i in range(N)] *A, = zip(*B) x = [] for a in range(N): if A[a].count('nyanpass') == N-1: x.append(a+1) if len(x) != 1: print(-1) else: print(*x) if __name__ == '__main__': main()