#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
const int INF = 114514810;
const int MOD = 1000000007;
const double EPS = 1e-10;
typedef double weight;
struct edge
{
	int to; weight cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};

typedef vector<edge> Edges;
typedef vector<Edges> Graph;
//int dx[] = { -1, 0, 0, 1 }; int dy[] = { 0, -1, 1, 0 };
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
int place(int x, int y, int w) { return w*x + y; }
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

typedef pair<int, double> pid;
struct data{ int lx, rx, lh, rh; double h; };
vector<data> v;

double add(int p, double w)
{
	REP(i, v.size())
	{
		if (v[i].lx <= p && v[i].rx>=p)
		{
			double bot = (v[i].rx - v[i].lx + 1) * 30;
			int minh = min(v[i].rh, v[i].lh);
			if (v[i].h - minh > -EPS)
			{
				if (v[i].h - v[i].lh > -EPS)
				{
					if (abs(v[i-1].h - v[i].h) < EPS) return w;
					else add(v[i - 1].lx, w);
				}
				else
				{
					if (abs(v[i + 1].h - v[i].h) < EPS) return w;
					else add(v[i + 1].lx, w);
				}
			}
			else
			{
				if ((minh - v[i].h)*bot - w > -EPS)
				{
					v[i].h += w / bot;
					return 0;
				}
				else
				{
					double rt = w - (minh - v[i].h)*bot;
					v[i].h = minh;
					return rt;
				}
			}
		}
	}
}

int main()
{
	int D;
	cin >> D;
	while (D--)
	{
		v.clear();
		int n, m, l;
		vector<pid> s;
		vector<pii> b, q;
		cin >> n;
		REP(i, n)
		{
			int x, y;
			cin >> x >> y;
			b.push_back(pii(x, y));
		}		
		cin >> m;
		REP(i, m)
		{
			int x, y;
			cin >> x >> y;
			s.push_back(pii(x, y));
		}
		cin >> l;
		REP(i, l)
		{
			int x, y;
			cin >> x >> y;
			q.push_back(pii(x, y));
		}

		v.push_back(data{ 0, b[0].first - 1, INF, b[0].second, 0 });
		REP(i, n - 1) v.push_back(data{ b[i].first, b[i + 1].first - 1, b[i].second, b[i + 1].second, 0 });
		v.push_back(data{ b.back().first, 99, b.back().second, INF, 0 });

		vector<bool> f(l); vector<double> ans(l);
		REP(i, l)
		{
			if (q[i].second >= 150000)
			{
				ans[i] = 50;
				f[i] = true;
			}
		}

		for (int time = 1;time<=150000; time++)
		{
			vector<pid> res = s;
			while (res.size())
			{
				vector<pid> nres;
				REP(i, res.size())
				{
					double d = add(res[i].first, res[i].second);
					if (d > EPS) nres.push_back(pid(res[i].first, d));
				}
				res = nres;

				vector<data> nv;
				REP(i, v.size())
				{
					if (i<v.size()-1 && v[i].h - v[i].rh > -EPS&&v[i+1].h - v[i+1].lh > -EPS)
					{
						nv.push_back(data{ v[i].lx, v[i + 1].rx, v[i].lh, v[i + 1].rh, v[i].h });
						i++;
					}
					else nv.push_back(v[i]);
				}
				v = nv;
			}

			bool end = true;
			REP(i, l)
			{
				if (q[i].second == time)
				{
					REP(j, v.size())
					{
						if (q[i].first >= v[j].lx&&q[i].first <= v[j].rx) 
							ans[i] = min(v[j].h, 50.0);
					}
					f[i] = true;
				}
				if (!f[i]) end = false;
			}
			if (end) break;
		}
		REP(i, l) cout << D10 << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1284