inputLines = [] gets.to_i.times{ inputLines.push(gets.chomp.split.map(&:to_i))} inputLines.each do |xl,xh,yl,yh| puts "SELECT count(*) FROM point WHERE #{xl} <= x <= #{xh} AND #{yl} <= y <= #{yh};" STDOUT.flush end