import numpy as np import collections n = int(input()) a = [input().split() for l in range(n)] arr_a = np.array(a) renindex = [] for i in range(arr_a.shape[0]): for j in range(arr_a.shape[1]): if arr_a[i][j] == 'nyanpass': renindex.append(j) cl = collections.Counter(renindex) renkeys = [k for k, v in cl.items() if v == n-1] if len(renkeys) == 1: print(renkeys[0] + 1) else: print(-1)