def main(): n = int(input()) a_lst = [ list(map(str, input().split(' '))) for i in range(n) ] aisatsu = 'nyanpass' ans_lst = [ 1 for i in range(n) ] for i in range(n): for j, ele_j in enumerate(a_lst[i]): if ele_j != aisatsu and ele_j != '-': ans_lst[j] = 0 ans = -1 for i, flag in enumerate(ans_lst): if flag == 1: if ans == -1: ans = i+1 else: ans = -1 break print(ans) if __name__ == '__main__': main()