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