#pragma GCC optimize("O3, unroll-loops")
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<random>
#include<chrono>
//#define int long long
#define ll long long
#define ld long double
using namespace std;
mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());

void solve() {
	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 a, b;
		cin >> b >> a;
		
		while (b--) {
			A.push_back(a);
		}
		/*
		if (b % 2 == 0) {
			A.push_back(a);
			A.push_back(a);
		}
		else {
			A.push_back(a);
		}*/
	}
	vector<int> B;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> b >> a;
		
		while (b--) {
			B.push_back(a);
		}
		/*
		if (b % 2 == 0) {
			B.push_back(a);
			B.push_back(a);
		}
		else {
			B.push_back(a);
		}*/
		
	}
	N = A.size();
	M = B.size();
	vector<vector<pair<bool, bool>>> dp(N + 1, vector<pair<bool, bool>>(M + 1, { 0,0 }));

	vector<pair<int, int>> fi1(K + 1, { -1, -1 });
	for (int i = N - 1; i >= 0; i--) {
		fi1[A[i]].first = i;
		vector<pair<int, int>> fi = fi1;
		for (int j = M - 1; j >= 0; j--) {
			fi[B[j]].second = j;
			for (int k = 1; k <= K; k++) {
				if (fi[k].first != -1 && fi[k].second != -1) {
					dp[i][j].first = dp[i][j].first || !dp[fi[k].first + 1][fi[k].second + 1].second;
					dp[i][j].second = dp[i][j].second || !dp[fi[k].first + 1][fi[k].second + 1].first;
				}
			}
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			//cout << dp[i][j].first << " ";
		}
		//cout << "\n";
	}
	for (int rep = 0; rep < q; rep++) {
		int a, b;
		cin >> a >> b;
		cout << (dp[a][b].first ? "Yes" : "No") << "\n";
	}

}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
	//cin >> t;
	t = 1;
	while (t--) {
		solve();
	}
}
