def ascan;gets.split.map(&:to_i);end n=gets.to_i users = (0...n).map{ascan} m=gets.to_i mentai = (0...m).map{ascan} cnts = [] mentai.map! do |me| x,y = me cnts << users.count{|a,b| x<=a && b<=y} end max_cnts = cnts.max m.times do |i| p i+1 if cnts[i] == max_cnts end