Q = gets.to_i 1.upto(Q) do x0,x1, y0,y1 = gets.split.map(&:to_i) puts "SELECT count(*) FROM point WHERE (x BETWEEN #{x0} AND #{x1}) AND (y BETWEEN #{y0} AND #{y1});" end STDOUT.flush