N = input() ren = [0 for i in range(N)] for i in range(N): greeting = raw_input().split() for j,greet in enumerate(greeting): if (greet == "nyanpass"): ren[j] += 1 cnt = 0 res = -1 for i in range(N): if (ren[i] == N - 1): cnt += 1 res = i if (res == -1 or cnt >= 2): print -1 else: print res + 1