n = gets.to_i cnt = Array.new(n, 0) num = 0 idx = -1 for j in 0..n-1 a = gets.chomp.split(" ") for i in 0..n-1 if a[i] == 'nyanpass' then cnt[i] += 1 end end end for i in 0..n-1 if cnt[i] == n-1 then idx = i num += 1 end end if num == 1 then puts(idx + 1) else puts(-1) end