#include <bits/stdc++.h>

#define int long long
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using namespace std;

const int maxN = 5010, maxK = 1610;

int N, n, M, m, k, q, dp[maxN][maxN];
bitset<maxK> suffa[maxN], suffb[maxN];
vector<int> a, b;
vector<int> posa[maxK], posb[maxK];

int solve(int i, int j) {
    if (dp[i][j] != -1) {
        return dp[i][j];
    }
    if (i >= N || j >= M) {
        return dp[i][j] = 0;
    }
    dp[i][j] = 0;
    bitset<maxK> maybe = suffa[i] & suffb[i];
    for (int c = maybe._Find_first(); c <= k; c = maybe._Find_next(c)) {
        int ni = *lower_bound(all(posa[c]), i);
        int nj = *lower_bound(all(posb[c]), j);
        dp[i][j] |= !solve(ni + 1, nj + 1);
    }
    return dp[i][j];
}

void solve_case() {
    cin >> N >> n >> M >> m >> k >> q;
    for (int i = 0; i < n; i++) {
        int l, v; cin >> l >> v;
        for (int j = 0; j < l; j++) {
            a.push_back(v);
        }
    }
    for (int i = 0; i < N; i++) {
        posa[a[i]].push_back(i);
    }
    for (int i = N - 1; i >= 0; i--) {
        suffa[i] = suffa[i + 1];
        suffa[i].set(a[i]);
    }
    for (int i = 0; i < m; i++) {
        int l, v; cin >> l >> v;
        for (int j = 0; j < l; j++) {
            b.push_back(v);
        }
    }
    for (int i = 0; i < M; i++) {
        posb[b[i]].push_back(i);
    }
    for (int i = M - 1; i >= 0; i--) {
        suffb[i] = suffb[i + 1];
        suffb[i].set(b[i]);
    }
    memset(dp, -1, sizeof dp);
    while (q--) {
        int x, y; cin >> x >> y;
        cout << (solve(x, y) ? "Yes" : "No") << '\n';
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
//    cin >> t;
    while (t--) {
        solve_case();
    }
}