N = int(input()) canset = list(range(N)) for i in range(N): W = input().split() for i in canset: if W[i] != 'nyanpass' and W[i] != '-': canset.remove(i) if len(canset) == 1: print(canset[0]) else: print(-1)