n = int(input()) la = [True]*n for i in range(n): ls = input().split() for j in range(n): if la[j] and ls[j] != "-" and ls[j] != "nyanpass": la[j] = False if True in la: if la.count(True) == 1: print(la.index(True)+1) else: print(-1) else: print(-1)