//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast,unroll-loops")
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <numeric>
#include <algorithm>
#include <random>
using ll = long long;
//#define int ll
#define all(a) a.begin(), a.end()

using namespace std;
//using namespace __gnu_pbds;

//using odered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rnd(0);

int N, n, M, m, k, q;
vector<int> a, b;
map<pair<int, int>, int> s;
vector<vector<int>> pa, pb;

bool rec(int i, int j) {
	if (i >= a.size() || j >= b.size()) return 0;
	if (s.count({ i, j })) return s[{i, j}];
	for (int c = 1; c <= k; c++) {
		int i1 = lower_bound(all(pa[c]), i) - pa[c].begin();
		int j1 = lower_bound(all(pb[c]), j) - pb[c].begin();
		if (i1 < pa[c].size() && j1 < pb[c].size() && !rec(pa[c][i1]+1, pb[c][j1]+1)) {
			s[{i, j}] = 1;
			return 1;
		}
	}
	s[{i, j}] = 0;
	return 0;
}

void solve() {
	cin >> N >> n >> M >> m >> k >> q;
	pa.resize(k + 1);
	pb.resize(k + 1);
	for (int i = 0; i < n; i++) {
		int l, v;
		cin >> l >> v;
		for (int j = 0; j < l; j++) {
			pa[v].push_back(a.size());
			a.push_back(v);
		}
	}
	for (int i = 0; i < m; i++) {
		int l, v;
		cin >> l >> v;
		for (int j = 0; j < l; j++) {
			pb[v].push_back(b.size());
			b.push_back(v);
		}
	}
	for (int i = 0; i < q; i++) {
		int x, y;
		cin >> x >> y;
		cout << (rec(x, y) ? "Yes" : "No") << '\n';
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#ifdef LOCAL
	auto f1 = freopen("input.txt", "r", stdin);
	auto f2 = freopen("output.txt", "w", stdout);
#endif

	solve();
}