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