def main(): n = int(input()) ren = [] for i in range(n): l = input().split() count = 0 for e in l: if e == "nyanpass": ren.append(count) count += 1 #print(ren) ren_set = set(ren) #print(ren_set) if len(ren_set) == 1: for e in ren_set: print(e) else: print(-1) if __name__ == '__main__': main()