n=gets.to_i a=(0...n).to_a.map{gets.chomp.split(/\s/)} f=Array.new(n,true) Array.new(n).zip(a.map{|r|r}){|c| c[1].map{|w|(w =~ /^-$|^nyanpass$/) == 0}.each_with_index{|fl,i| f[i]=false if !fl}} puts f.count(true)==1 ? f.index{|v|v}+1 : -1