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