gets.to_i.times do x1,x2,y1,y2 = gets.split.map(&:to_i) puts "SELECT counr(*) FROM point WHERE #{x1}<=x AND x<=#{x2} AND #{y1}<=y AND #{y2}<=y;" STDOUT.flush end