#ifdef LOCAL
#pragma optimize("", off)
#include "localstd1.h"
#else
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/allocator.h>
#pragma GCC target("avx2,bmi,bmi2")
#include <bits/stdc++.h>
#endif

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define all(a) (a).begin(), (a).end()

struct Seg {
	int val;
	int l, r; //half-interval
};

vector<Seg> read(int n) {
	int cnt = 0;
	vector<Seg> res(n);
	for (int i = 0; i < n; i++) {
		int len, val; cin >> len >> val;
		res[i] = { val - 1, cnt, cnt + len };
		cnt += len;
	}
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int N, n, M, m, k, q; cin >> N >> n >> M >> m >> k >> q;
	vector<Seg> a = read(n), b = read(m);
	const int MAXN = 100; //1601
	bool dp[MAXN][MAXN];
	dp[n][m] = false;
	vector<bool> is_win(k, true);
	int cntl = 0;

	auto get_byi = [&](int i, int j, int coordi, int coordj) {
		bool end_win = dp[i][j];
		return end_win || min(a[i].r - coordi, b[j].r - coordj) % 2 == 0;
	};

	for (int i = n - 1; i >= 0; i--) {
		for (int j = m - 1; j >= 0; j--) {
			dp[i][j] = bool(cntl);
		}

		for (int j = 0; j < m - 1; j++) {
			int col = a[i].val;
			if (col == b[j].val) {
				cntl -= is_win[col] == false;
				is_win[col] = get_byi(i, j, a[i].l, b[j].l);
				cntl += is_win[col] == false;
			}
		}
	}

	auto get_byc = [&](int coordi, int coordj) {
		int i = lower_bound(all(a), coordi, [](Seg seg, int coord) {return seg.l < coord; }) - a.begin();
		int j = lower_bound(all(b), coordj, [](Seg seg, int coord) {return seg.l < coord; }) - b.begin();
		return (get_byi(i, j, coordi - 1, coordj - 1) ? "Yes" : "No");
	};
	while (q--) {
		int x, y; cin >> x >> y;
		cout << get_byc(x, y) << '\n';
	}
	
	return 0;
}