A=[input().split() for _ in '1'*int(input())] B=[set(i) for i in zip(*A)] T={'nyanpass', '-'} print(B.index(T)+1 if B.count(T)==1 else -1)