n = gets.to_i as = [] n.times do as << gets.split end bs = as.transpose ans = [] bs.each_with_index do |b, i| if b.count('nyanpass') == n -1 ans << i end end if ans.count == 1 puts ans.first + 1 else puts -1 end