#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;
		while (l--) a.push_back(x);
	}
	while (m--) {
		ll l, x; cin >> l >> x;
		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;
		unordered_map<ll, bool> cc;
		int cnt = 0;
		for (int j = b.size() - 1; j >= 0; j--) {
			cid2[b[j]] = j + 1;
			auto f = cid[b[j]] - 1;
			if (f != -1 && !first[f + 1][j + 1]) {
				if (!cc[f]) cnt++;
				cc[f] = true;
			}
			else {
				if (cc[f]) cnt--;
				cc[f] = false;
			}
			first[i][j] = cnt > 0;
		}
	}
	while (q--) {
		ll a, b; cin >> a >> b;
		if (first[a][b]) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
}