#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <set>
#include <unordered_set>

using namespace std;

using ll = long long;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	ll n, m, k, q; cin >> n >> n >> m >> m >> k >> q;
	vector<ll> a, b;
	while (n--) {
		ll l, x; cin >> l >> x;
		l = l % 2;
		while (l--) a.push_back(x);
	}
	while (m--) {
		ll l, x; cin >> l >> x;
		l = l % 2;
		while (l--) b.push_back(x);
	}
	vector<ll> colors;
	for (auto p : a) colors.push_back(p);
	for (auto p : b) colors.push_back(p);
	sort(colors.begin(), colors.end());
	colors.erase(unique(colors.begin(), colors.end()), colors.end());
	vector<vector<bool>> first(a.size() + 1, vector<bool>(b.size() + 1));
	unordered_map<ll, ll> cid;
	for (int i = a.size() - 1; i >= 0; i--) {
		cid[a[i]] = i + 1;
		unordered_map<ll, ll> cid2;
		for (int j = b.size() - 1; j >= 0; j--) {
			cid2[b[j]] = j + 1;
			for (auto next : colors) {
				ll ni = cid[next] - 1;
				ll nj = cid2[next] - 1;
				if (ni == -1 || nj == -1) continue;
				if (!first[ni + 1][nj + 1]) {
					first[i][j] = true;
					break;
				}
			}
		}
	}
	while (q--) {
		ll a, b; cin >> a >> b;
		if (first[a][b]) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
}