#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll infll = 1e18;

template<typename T>
istream& operator>>(istream& is, vector<T>& a) {
	for (auto& i : a) {
		is >> i;
	}
	return is;
}

mt19937 rng(228);

int32_t main() {
#ifdef LOCAL
	assert(freopen("C:\\Users\\User\\input.txt", "r", stdin));
#else
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
#endif
	int N, n, M, m, k, q;
	cin >> N >> n >> M >> m >> k >> q;
	vector<int> a;
	for (int i = 0; i < n; ++i) {
		int l, v;
		cin >> l >> v;
		for (int j = 0; j < l; ++j) {
			a.push_back(v);
		}
	}
	vector<int> b;
	for (int i = 0; i < m; ++i) {
		int l, v;
		cin >> l >> v;
		for (int j = 0; j < l; ++j) {
			b.push_back(v);
		}
	}
	while (q--) {
		int x, y;
		cin >> x >> y;
		vector<int> A;
		for (int i = x; i < N; ++i) {
			A.push_back(a[i]);
		}
		vector<int> B;
		for (int i = y; i < M; ++i) {
			B.push_back(b[i]);
		}
		vector<vector<int>> dp(A.size() + 1, vector<int>(B.size() + 1));
		for (int i = 1; i <= (int)A.size(); ++i) {
			for (int j = 1; j <= (int)B.size(); ++j) {
				if (A[i - 1] == B[j - 1]) {
					dp[i][j] = dp[i - 1][j - 1] + 1;
				}
				else {
					dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
				}
			}
		}
		if (dp[A.size()][B.size()] % 2 == 1) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
	}
	return 0;
}