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

//#pragma GCC optimize("O3, unroll-loops")
//#pragma GCC target("avx2, avx, lzcnt, popcnt, bmi, bmi2")

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int N, n, M, m, k, q;
	cin >> N >> n >> M >> m >> k >> q;
	vector<int> A(N);
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		int l, x;
		cin >> l >> x;
		for (int j = 0; j < l; j++) {
			A[cnt + j] = x - 1;
		}
		cnt += l;
	}
	vector<int> B(M);
	cnt = 0;
	for (int i = 0; i < m; i++) {
		int l, x;
		cin >> l >> x;
		for (int j = 0; j < l; j++) {
			B[cnt + j] = x - 1;
		}
		cnt += l;
	}
	vector<vector<pair<int, int>>> pred1(N, vector<pair<int, int>>(k));
	for (int i = N - 1; i >= 0; i--) {
		if (i != N - 1) {
			for (auto elem: pred1[i + 1]) {
				if (elem.first < A[i] or elem.first > A[i]) {
					pred1[i].push_back(elem);
				}
				else {
					pred1[i].push_back({ A[i], i });
				}
			}
		}
		else {
			pred1[i] = { {A[i], i} };
		}
	}
	vector<vector<pair<int, int>>> pred2(N, vector<pair<int, int>>(k));
	for (int i = M - 1; i >= 0; i--) {
		if (i != M - 1) {
			for (auto elem : pred2[i + 1]) {
				if (elem.first < B[i] or elem.first > B[i]) {
					pred2[i].push_back(elem);
				}
				else {
					pred2[i].push_back({ B[i], i });
				}
			}
		}
		else {
			pred2[i] = { {B[i], i} };
		}
	}
	vector<vector<bool>> dp(N + 1, vector<bool>(M + 1, false));
	for (int i = N - 1; i >= 0; i--) {
		for (int j = M - 1; j >= 0; j--) {
			if (A[i] == B[j] or (i != 0 and j != 0 and A[i - 1] == B[j - 1])) {
				int ind = 0;
				for (auto elem : pred1[i]) {
					while (ind != pred2[j].size() and pred2[j][ind].first < elem.first) {
						ind++;
					}
					if (pred2[j][ind].first == elem.first and not dp[elem.first + 1][pred2[j][ind].first + 1]) {
						dp[i][j] = true;
						break;
					}
				}
			}
		}
	}
	for (int _ = 0; _ < q; _++) {
		int x, y;
		cin >> x >> y;
		if (dp[x][y]) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
	}
}