# from pprint import pprint # from icecream import ic def main(): N=int(input()) S="nyanpass" a=[[] for i in range(N)] for i in range(N): a[i]=input().split() q=set() r=set(range(1,N+1)) for i in range(N): for j in range(N): if i!=j and a[j][i]!=S: q.add(i+1) ans=r-q if len(ans)==1: for i in ans: print(i) else: print(-1) if __name__=="__main__": main()