require 'mathn'

class Tank
	def initialize(*args)
		@l_x, @r_x, @l_height, @r_height = args
		@water = 0
		@dw = 0
	end

	def area
		(@r_x - @l_x) * 30
	end

	def lower_height
		@l_height < @r_height ? @l_height : @r_height
	end

	def time_to_fill
		@dw == 0 ? Float::INFINITY : (lower_height * area - @water) / @dw	
	end

	def water_height
		@water / area
	end

	attr_accessor :l_x, :r_x, :l_height, :r_height, :water, :dw
end

test_num = gets.to_i

test_num.times {
	n = gets.to_i
	board = (1..n).map{gets.split.map &:to_i}
	board.unshift [0, 50]
	board << [100, 50]

	m = gets.to_i
	faucet = (1..m).map{gets.split.map &:to_i}

	l = gets.to_i
	query = (0..l-1).map{|i| [i] + gets.split.map(&:to_i)}.sort_by(&:last)

	tanks = board.each_cons(2).map{|(x1, h1), (x2, h2)|
		Tank.new(x1, x2, h1, h2)	
	}

	faucet.each{|fx, a|
		tanks.find{|t| fx < t.r_x}.dw += a
	}


	time = 0
	ans = []
	loop do	
		dt = tanks.map{|tank|
			tank.time_to_fill	
		}.min

		if time + dt >= query[0][2]
			i, qx, t = query.shift
			tank = tanks.find{|t| qx < t.r_x}
			ans[i] = (tank.water + tank.dw * (t - time)) / tank.area
			break if query.empty?
		end

		tanks.each{|tank|
			tank.water += dt * tank.dw
		}

		tanks.sort_by.with_index{|t, i| [-t.water_height, i]}.each{|tank|
			next if tank.water_height < tank.lower_height

			if tank.water_height == 50
				tank.dw = 0
			elsif tank.l_height < tank.r_height
				l_tank = tanks.find{|t| t.r_x == tank.l_x}
				if l_tank.water_height == tank.water_height
					raise
				else
					l_tank.dw += tank.dw
					tank.dw = 0
				end
			else
				r_tank = tanks.find{|t| t.l_x == tank.r_x}
				if r_tank.water_height == tank.water_height
					tank.water += r_tank.water
					tank.dw += r_tank.dw
					tank.r_x = r_tank.r_x
					tank.r_height = r_tank.r_height
					r_tank.water = -1
				else
					r_tank.dw += tank.dw
					tank.dw = 0
				end
			end
		}
		tanks.reject!{|t| t.water < 0}

		time += dt
	end	

	puts ans.map(&:to_f)

}