#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#define ll long long
#define len(x) (int)x.size()
#define ld long double
#define all(x) x.begin(), x.end()
const ll mod1 = 1e9 + 7;

using namespace std;

void print(vector<int>& a) {
	for (auto x : a) {
		cout << x << ' ';
	}
	cout << '\n';
}

void print(vector<ll>& a) {
	for (auto x : a) {
		cout << x << ' ';
	}
	cout << '\n';
}

void print(vector<char>& a) {
	for (auto x : a) {
		cout << x << ' ';
	}
	cout << '\n';
}

void print(vector<string>& a) {
	for (auto x : a) {
		cout << x << ' ';
	}
	cout << '\n';
}

void print(vector<pair<int, int>>& a) {
	for (auto x : a) {
		cout << x.first << ' ' << x.second << '\n';
	}
}

void print(vector<vector<int>>& a) {
	for (auto x : a) {
		print(x);
	}
}

void print(vector<vector<ll>>& a) {
	for (auto x : a) {
		print(x);
	}
}

//#define int ll
//#define mtask

void solve() {
	int ln, n, lm, m, k, q;
	cin >> ln >> n >> lm >> m >> k >> q;
	vector<int> a;
	vector<int> b;
	for (int i = 0; i < n; ++i) {
		int l, v;
		cin >> l >> v;
		--v;
		while (l--) {
			a.push_back(v);
		}
	}
	for (int i = 0; i < m; ++i) {
		int l, v;
		cin >> l >> v;
		--v;
		while (l--) {
			b.push_back(v);
		}
	}
	vector<vector<bool>> dp(ln + 1, vector<bool>(lm + 1));
	for (int i = ln - 1; i >= 0; --i) {
		for (int j = lm - 1; j >= 0; --j) {
			vector<int> lst(k, -1);
			for (int t = ln - 1; t >= i; --t) {
				lst[a[t]] = t;
			}
			for (int t = j; t < lm; ++t) {
				if (lst[b[t]] != -1) {
					if (!dp[lst[b[t]] + 1][t + 1]) {
						dp[i][j] = true;
						break;
					}
					lst[b[t]] = -1;
				}
			}
		}
	}
	while (q--) {
		int x, y;
		cin >> x >> y;
		if (dp[x][y]) {
			cout << "Yes\n";
			continue;
		}
		cout << "No\n";
	}
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifdef LOCAL
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
#ifdef mtask
	int tt;
	cin >> tt;
	while (tt--)
#endif
		solve();
}