#include <bits/stdc++.h>
using namespace std;

void pour(int pos, int l, int r, double& a, vector<double> const& x, vector<double> const& h, vector<double>& ans) {
    if(r - l > 1) {
        int mid = l + 1;
        for(int i = l + 1; i < r; ++i) {
            if(h[mid] < h[i]) {
                mid = i;
            }
        }
        if(pos < mid) {
            pour(pos, l, mid, a, x, h, ans);
            pour(pos, mid, r, a, x, h, ans);
        } else {
            pour(pos, mid, r, a, x, h, ans);
            pour(pos, l, mid, a, x, h, ans);
        }
    }

    double side_h = min(h[l], h[r]);
    double add = max(0.0, (side_h - ans[l]) * (x[r] - x[l]));
    add = min(add, a);
    a -= add;
    for(int i = l; i < r; ++i) {
        ans[i] += add / (x[r] - x[l]);
    }
}

int main() {
    int D; cin >> D;
    while(D--) {
        int N; cin >> N;
        vector<double> x(N + 2), h(N + 2);
        for(int i = 1; i <= N; ++i) {
            cin >> x[i] >> h[i];
        }
        x[N + 1] = 100;
        h[0] = h[N + 1] = 50;
        int M; cin >> M;
        vector<double> in(N + 1);
        for(int i = 0; i < M; ++i) {
            int F, A; cin >> F >> A;
            int j = upper_bound(begin(x), end(x), F) - begin(x) - 1;
            in[j] += A / 30.0;
        }

        int L; cin >> L;
        while(L--) {
            int P, T; cin >> P >> T;
            vector<double> ans(N + 1);
            for(int i = 0; i < N + 1; ++i) {
                double a = in[i] * T;
                pour(i, 0, N + 1, a, x, h, ans);
            }
            int j = upper_bound(begin(x), end(x), P) - begin(x) - 1;
            cout << fixed << setprecision(6) << ans[j] << endl;
        }
    }
}

