#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

const int W = 100, H = 50, D = 30;
vector<int> x, h;

void pour(int pos, int l, int r, double& amt, vector<double>& ans) {
    if (r - l > 1) {
        int sep = max_element(h.begin() + l + 1, h.begin() + r) - h.begin();
        if (pos < sep) {
            pour(pos, l, sep, amt, ans); pour(pos, sep, r, amt, ans);
        } else {
            pour(pos, sep, r, amt, ans); pour(pos, l, sep, amt, ans);
        }
    }
    double side = min(h[l], h[r]);
    double add = min(amt, (side - ans[l]) * (x[r] - x[l]));
    amt -= add;
    for (int i = l; i < r; i++) ans[i] += add / (x[r] - x[l]);
}

#include <iomanip>
int main() {
    cout << fixed << setprecision(6);
    int DD; cin >> DD;
    while (DD--) {
        int N; cin >> N;
        x.assign(N + 2, 0), h.assign(N + 2, H);     // boards
        for (int i = 1; i <= N; i++) cin >> x[i] >> h[i];
        x[0] = 0, x[N + 1] = W;
        h[0] = h[N + 1] = H;

        int M; cin >> M;
        vector<double> flow(N + 1, 0);
        while (M--) {                               // faucets
            int pos, amount; cin >> pos >> amount;
            int i = lower_bound(x.begin(), x.end(), pos) - begin(x) - 1;
            flow[i] += 1.0 * amount / D;
        }

        int L; cin >> L;
        while (L--) {                               // queries
            int pos, time; cin >> pos >> time;
            vector<double> ans(N + 1, 0);
            for (int i = 0; i <= N; i++) {
                double amt = flow[i] * time;
                pour(i, 0, N + 1, amt, ans);
            }
            int i = lower_bound(x.begin(), x.end(), pos) - begin(x) - 1;
            cout << ans[i] << endl;
        }
    }
    return 0;
}
