def main(): N = int(input()) number = -1 gss = [ input().split() for _ in range(N) ] for gs in gss: for i, g in enumerate(gs, 1): if g != "nyanpass": continue if number == -1: number = i elif number != i: print(-1) return print(number) if __name__ == '__main__': main()