#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <bitset>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <set>
#include <map>

using namespace std;

#define for0(i, n) for (ll i = 0; i < n; ++i)
#define for1(i, n) for (ll i = 1; i <= n; ++i)
#define fora(i, v) for (auto i : v)
#define ft first
#define sd second
#define pk push_back
#define pok pop_back
#define ret return
#define con continue
#define sz(v) v.size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using ll = long long;
using pll = pair <ll, ll>;
using vll = vector <ll>;
using vpll = vector <pll>;
using vvll = vector <vll>;
using pi = pair <int, int>;
using vi = vector <int>;
using vpi = vector <pi>;
using vvi = vector <vector <int>>;

ll N, n, M, m, k, q, p, l, v, x, y;
ll a[5001], b[5001], n1[1601], n2[1601], ans[5001][5001];

int main() {
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(false);
	cin >> N >> n >> M >> m >> k >> q;
	p = 1;
	for1(i, n) {
		cin >> l >> v;
		while (l--)
			a[p++] = v;
	}
	p = 1;
	for1(i, m) {
		cin >> l >> v;
		while (l--)
			b[p++] = v;
	}
	for1(i, 1600) {
		n1[i] = -1; n2[i] = -1;
	}
	for (ll i = N; i >= 1; --i) {
		for (ll j = M; j >= 1; --j) {
			if (a[i] == b[j]) {
				if (n1[a[i]] == -1 || n2[b[j]] == -1 || ans[n1[a[i]]][n2[b[j]]] == 0)
					ans[i][j] = 1;
			}
			n2[b[j]] = j;
		}
		n1[a[i]] = i;
		for1(j, 1600)
			n2[j] = -1;
	}
	while (q--) {
		cin >> x >> y;
		if (ans[x + 1][y + 1])
			cout << "Yes\n";
		else
			cout << "No\n";
	}
	ret 0;
}