#include <bits/stdc++.h>
using namespace std;


using ll = long long;
const ll inf = 1e18;


int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> la(n), va(n), lb(m), vb(m);
    for (int i = 0; i < n; ++i) {
        cin >> la[i] >> va[i];
        --va[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> lb[i] >> vb[i];
        --vb[i];
    }
    vector<vector<int>> nxa(n + 1, vector<int>(k, n)), nxb(m + 1, vector<int>(k, m));
    for (int i = n - 1; i >= 0; --i) {
        nxa[i] = nxa[i + 1];
        nxa[i][va[i]] = i;
    }
    for (int j = m - 1; j >= 0; --j) {
        nxb[j] = nxb[j + 1];
        nxb[j][vb[j]] = j;
    }
    vector<vector<bool>> dp(n, vector<bool>(m));
    vector<vector<bool>> to_loose(n + 2, vector<bool>(m + 2));
    function<bool(int, int, int, int)> calc = [&](int i, int l1, int j, int l2) -> bool {
        bool ret = true;
        while (i < n && j < m && !to_loose[i][j]) {
            int d = min(l1, l2);
            int ni, nl1 = 0, nj, nl2 = 0;
            if (l1 <= l2) {
                ni = nxa[i + 1][va[i]];
                if (ni < n) nl1 = la[ni];
            } else {
                ni = i;
                nl1 = l1 - l2;
            }
            if (l2 <= l1) {
                nj = nxb[j + 1][vb[j]];
                if (nj < m) nl2 = lb[nj];
            } else {
                nj = j;
                nl2 = l2 - l1;
            }
            i = ni, j = nj, l1 = nl1, l2 = nl2;
            if (~d & 1) ret = !ret;
        }
        return ret;
    };
    for (int i = n - 1; i >= 0; --i) {
        for (int j = m - 1; j >= 0; --j) {
            if (va[i] != vb[j]) continue;
            for (int c = 0; c < k; ++c) {
                if (c == va[i]) continue;
                if (nxa[i][c] < n && nxb[j][c] < m && !dp[nxa[i][c]][nxb[j][c]]) to_loose[i][j] = true;
            }
            dp[i][j] = calc(i, la[i] - 1, j, lb[j] - 1);
        }
    }
    vector<int> prefa(n);
    partial_sum(la.begin(), la.end(), prefa.begin());
    vector<int> prefb(m);
    partial_sum(lb.begin(), lb.end(), prefb.begin());
    while (q--) {
        int x, y;
        cin >> x >> y;
        int i = upper_bound(prefa.begin(), prefa.end(), x) - prefa.begin();
        int j = upper_bound(prefb.begin(), prefb.end(), y) - prefb.begin();
        x = prefa[i] - x;
        y = prefb[j] - y;
        if (calc(i, x, j, y)) cout << "Yes\n";
        else cout << "No\n";
    }
}

/*
10 6 10 9 3 1
1 3
3 1
2 2
1 3
1 1
2 3
1 1
1 2
1 1
1 2
1 3
1 1
2 2
1 3
1 2
3 2
 */