#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(N);
	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<int>> pred1(N, vector<int>(k, N));
	for (int i = N - 1; i >= 0; i--) {
		if (i != N - 1) {
			pred1[i] = pred1[i + 1];
		}
		pred1[i][A[i]] = i;
	}
	vector<vector<int>> pred2(M, vector<int>(k, M));
	for (int i = M - 1; i >= 0; i--) {
		if (i != M - 1) {
			pred2[i] = pred2[i + 1];
		}
		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--) {
			for (int t = 0; t < k; t++) {
				if (pred1[i][t] != M and pred2[j][t] != M and not dp[pred1[i][t] + 1][pred2[j][t] + 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";
		}
	}
}