// AOJ 1133: Water Tank
// 2018.2.20 bal4u

#include <stdio.h>
#include <string.h>

int n;
int b[12]; int h[12];
double x[12], ans[12];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

double calc(int pos, int l, int r, double y)
{
	int i, m, k;
	double dy;

	if (r-l > 1) {
        for (m = i = l+1; i < r; i++) if (h[m] < h[i]) m = i;
        if (pos < m) {
			y = calc(pos, l, m, y);
			y = calc(pos, m, r, y);
		} else {
			y = calc(pos, m, r, y);
			y = calc(pos, l, m, y);
		}
    }

    k = h[l]; if (k > h[r]) k = h[r];
    dy = (k-ans[l]) * (b[r]-b[l]); if (dy < 0) dy = 0;
	if (dy > y) dy = y;
	y -= dy;
    for (i = l; i < r; i++) ans[i] += dy / (b[r] - b[l]);
	return y;
}

int bsch(int x)
{
	int m, l = 0, r = n+1;

    while (l < r) {
        m = (l+r) >> 1;
        if (b[m] <= x) l = m + 1; else r = m;
    }
	return l;
}

int main()
{
	int cno, i, m, l, f, a, p, t;

	cno = in(); while (cno--) {
		n = in();
		b[0] = 0, h[0] = 50, b[n+1] = 100, h[n+1] = 50;
		for (i = 1; i <= n; i++) b[i] = in(), h[i] = in();

		memset(x, 0, sizeof(x));
		m = in(); while (m--) {
			f = in(), a = in();
            x[t=bsch(f)-1] += a/30.0;
        }

		l = in(); while (l--) {
			p = in(), t = in();
			memset(ans, 0, sizeof(ans));
			for (i = 0; i <= n; i++) calc(i, 0, n+1, x[i]*t);
			printf("%lf\n", ans[t=bsch(p)-1]);
		}
	}
	return 0;
}

