#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<unordered_set>
#include<unordered_map>
#include<iomanip>
#include<random>
#include<bitset>
#include<ctime>

#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2")

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
mt19937 mt(time(0));
const int N = 5e3 + 2, inf = 1e9 + 100, mod = 1e9 + 7, mod2 = 998244353, P = 257;
const ll llinf = 1e18 + 100;
bool dp[N][N];
int cn, n, cm, m,k, q, a[N], b[N];

void solve() {
	cin >> n >> cn >> m >> cm >> k >> q;
	int l1 = 0;
	for (int i = 0; i < cn; ++i) {
		int cnt, x;
		cin >> cnt >> x;
		while (cnt--) a[l1++] = x;
	}
	l1 = 0;
	for (int i = 0; i < cm; ++i) {
		int cnt, x;
		cin >> cnt >> x;
		while (cnt--) b[l1++] = x;
	}
	for (int i = n - 1; i >= 0; --i) {
		for (int j = n - 1; j >= 0; --j) {
			if (a[i] == a[j]) {
				if (dp[i + 1][j + 1] == 0) dp[i][j] = 1;
			}
			else {
				dp[i][j] |= dp[i + 1][j];
				dp[i][j] |= dp[i][j + 1];
			}
		}
	}
	while (q--) {
		int x, y;
		cin >> x >> y;
		cout << (dp[x][y] ? "Yes" : "No") << '\n';
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int tt = 1;
	//cin >> tt;
	while (tt--) {
		solve();
		cout << '\n';
		cout.flush();
	}
	return 0;
}