N = int(input()) nyan = [1]*N for i in range(N): hello = list(input().split()) nyan = [ny and (h == 'nyanpass' or h == '-') for ny, h in zip(nyan, hello)] if sum(nyan) == 1: print(nyan.index(1) + 1) else: print(-1)