n = int(input()) greet = [input().split() for i in range(n)] sorted_table = [] for i in range(n): greet_in_row = [row[i] for row in greet] sorted_table.append(greet_in_row) nyanpass_cnt = [] for i in range(len(sorted_table)): l = sorted_table[i] l.remove("-") sl = set(l) if (len(sl) == 1) and (sl) == {"nyanpass"}: nyanpass_cnt.append(True) else: nyanpass_cnt.append(False) if True in nyanpass_cnt: if nyanpass_cnt.count(True) == 1: print(nyanpass_cnt.index(True) + 1) else: print(-1) else: print(-1)