def main(): n = int(input()) d = {} for i in range(n): d[i] = 0 for i in range(n): l = input().split() count = 0 for e in l: if e == "nyanpass": d[count] += 1 count += 1 ren = [] for k,v in d.items(): #print(k,v) if v == n - 1: ren.append(k) ren_size = len(ren) if ren_size == 1: print(ren[0] + 1) else: print(-1) if __name__ == '__main__': main()