#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <ctime>
#include <chrono>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <deque>
#include <bitset>
#include <queue>
using namespace std;
mt19937_64 rnd(time(NULL));

const long long INF = 1e18, MOD = 1e9 + 7;

void solve()
{
	long long ns, n, ms, m, k, q;
	cin >> ns >> n >> ms >> m >> k >> q;
	vector<long long> a, b, inita, initb;
	inita.reserve(ns);
	initb.reserve(ms);
	vector<pair<long long, long long>> posa(k), posb(k), posia(k), posib(k);
	for (long long i = 0; i < n; i++)
	{
		long long len, val;
		cin >> len >> val;
		val--;
		for (long long _ = 0; _ < min(len, 4ll); _++)
		{
			a.push_back(val);
		}
		for (long long _ = 0; _ < len; _++)
		{
			inita.push_back(val);
		}
		posa[val] = { a.size() - len, a.size() - 1 };
		posia[val] = { inita.size() - len, inita.size() - 1 };
	}
	for (long long i = 0; i < m; i++)
	{
		long long len, val;
		cin >> len >> val;
		val--;
		for (long long _ = 0; _ < min(len, 4ll); _++)
		{
			b.push_back(val);
		}
		for (long long _ = 0; _ < len; _++)
		{
			initb.push_back(val);
		}
		posb[val] = { b.size() - len, b.size() - 1 };
		posib[val] = { initb.size() - len, initb.size() - 1 };
	}
	ns = a.size();
	ms = b.size();

	vector<vector<bool>> dp(ns + 1, vector<bool>(ms + 1, false));
	vector<long long> nxta(k, ns);
	for (long long i = ns; i > -1; i--)
	{
		if (i < ns)
		{
			nxta[a[i]] = i;
		}
		vector<long long> nxtb(k, ms);
		vector<long long> win(k);
		long long cntlose = 0;
		for (long long j = ms; j > -1; j--)
		{
			if (j < ms)
			{
				long long val = b[j];
				if (win[val] == -1)
				{
					cntlose--;
				}
				nxtb[b[j]] = j;
				if (nxta[val] != ns && nxtb[val] != ms)
				{
					if (!dp[nxta[val] + 1][nxtb[val] + 1])
					{
						win[val] = -1;
						cntlose++;
					}
					else
					{
						win[val] = 1;
					}
				}
			}
			if (cntlose)
			{
				dp[i][j] = true;
			}
		}
	}

	while (q--)
	{
		long long x, y;
		cin >> x >> y;
		long long val = inita[x];
		long long dista = posia[val].second - x + 1, distb = posib[val].second - y + 1;
		long long sub = min(dista, distb) / 2;
		if (sub)
		{
			sub--;
		}
		dista -= sub * 2;
		distb -= sub * 2;
		if (dista > distb)
		{
			if (dista > 4)
			{
				if (dista % 2 != distb % 2)
				{
					dista = distb + 1;
				}
				else
				{
					dista = distb + 2;
				}
			}
		}
		else if (dista < distb)
		{
			if (distb > 4)
			{
				if (dista % 2 != distb % 2)
				{
					distb = dista + 1;
				}
				else
				{
					distb = dista + 2;
				}
			}
		}
		x = posa[val].second - dista + 1;
		y = posb[val].second - distb + 1;

		cout << (dp[x][y] ? "Yes\n" : "No\n");
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}

	return 0;
}

/*

























*/
