# No.239 にゃんぱすー n = int(input()) a = [input().split() for i in range(n)] villegers = [0] * n for i in range(n): if a[0][i] == 'nyanpass' or a[0][i] == '-': candidate = i for j in range(n): if j != i and a[j][i] != 'nyanpass': candidate = -1 break if candidate != - 1: villegers[candidate] = 1 print(villegers.index(1) + 1 if villegers.count(1) == 1 else -1)