n = int(input()) ls = [] for i in range(n): ls.append(input().split()) res_list = [] for i in range(n): counter = 1 for j in range(n): if (ls[j][i] != 'nyanpass') and (ls[j][i] != '-'): break else: res_list.append(i + 1) if len(res_list) != 1: print(-1) else: print(res_list[0])