#include<bits/stdc++.h>

using namespace std;

typedef int ll;

template<typename T>
bool assign_max(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
bool assign_min(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

ll fm(vector<ll> arr) {
	vector<bool> be(arr.size() + 1, false);
	for (auto i : arr) {
		if (i == -1) {
			continue;
		}
		be[i] = true;
	}
	for (ll i = 0;; i++) {
		if (!be[i]) {
			return i;
		}
	}
}

ll get(ll a1i, ll a1c, ll a2i, ll a2c, vector<pair<ll, ll>>& a1, vector<pair<ll, ll>>& a2, vector<vector<ll>>& nca1, vector<vector<ll>>& nca2, vector<vector<pair<ll, ll>>>& dp, ll k) {
	if (a1i == a1.size()) {
		return -1;
	}
	if (a2i == a2.size()) {
		return -1;
	}
	ll c1 = a1[a1i].first - a1c;
	ll c2 = a2[a2i].first - a2c;
	ll x = min(c1, c2);
	a1c += x;
	a2c += x;
	c1 -= x;
	c2 -= x;
	ll nc = a1[a1i].second;
	auto[fm, sm] = dp[a1i][a2i];
	ll additional = get((c1 == 0 ? nca1[a1i][nc] : a1i), (c1 == 0 ? 1 : a1c + 1), (c2 == 0 ? nca2[a2i][nc] : a2i), (c2 == 0 ? 1 : a2c + 1), a1, a2, nca1, nca2, dp, k);
	if (additional == fm) {
		swap(fm, sm);
	}
	return (x % 2 == 0 ? fm : sm);
}

void solve() {
	ll N, n, M, m, k, q;
	cin >> N >> n >> M >> m >> k >> q;
	vector<pair<ll, ll>> a1(n), a2(m);
	vector<vector<ll>> nca1(n, vector<ll>(k, n)), nca2(m, vector<ll>(k, m));
	vector<ll> ps1(1, 0), ps2(1, 0);
	for (ll i = 0; i < n; i++) {
		cin >> a1[i].first >> a1[i].second;
		a1[i].second--;
		ps1.push_back(ps1.back() + a1[i].first);
	}
	for (ll i = 0; i < m; i++) {
		cin >> a2[i].first >> a2[i].second;
		a2[i].second--;
		ps2.push_back(ps2.back() + a2[i].first);
	}
	for (ll i = n - 2; i >= 0; i--) {
		nca1[i] = nca1[i + 1];
		nca1[i][a1[i + 1].second] = i + 1;
	}
	for (ll i = m - 2; i >= 0; i--) {
		nca2[i] = nca2[i + 1];
		nca2[i][a2[i + 1].second] = i + 1;
	}
	vector<vector<pair<ll, ll>>> dp(n, vector<pair<ll, ll>>(m));
	vector<vector<ll>> dp2(n, vector<ll>(m, 0));
	for (ll i = n - 1; i >= 0; i--) {
		for (ll j = m - 1; j >= 0; j--) {
			if (a1[i].second == a2[j].second) {
				vector<ll> allp;
				for (ll nc = 0; nc < k; nc++) {
					if (nc != a1[i].second && nca1[i][nc] < n && nca2[j][nc] < m) {
						allp.push_back(dp2[nca1[i][nc]][nca2[j][nc]]);
					}
				}
				ll x = fm(allp);
				allp.push_back(x);
				ll y = fm(allp);
				dp[i][j] = make_pair(x, y);
				dp2[i][j] = get(i, 1, j, 1, a1, a2, nca1, nca2, dp, k);
			}
		}
	}
	for (ll i = 0; i < q; i++) {
		ll x, y;
		cin >> x >> y;
		ll c1 = upper_bound(ps1.begin(), ps1.end(), x) - ps1.begin() - 1;
		x -= ps1[c1];
		ll c2 = upper_bound(ps2.begin(), ps2.end(), y) - ps2.begin() - 1;
		y -= ps2[c2];
		cout << (get(c1, x, c2, y, a1, a2, nca1, nca2, dp, k) == 0 ? "No" : "Yes") << '\n';
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	solve();
}
