#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
#ifdef home
    freopen("f.in", "r", stdin);
    freopen("f.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    vector<int> a, b;
    vector<int> evr;
    while (n--) {
        int l, v;
        cin >> l >> v;
        v--;
        while (l--) {
            a.emplace_back(v);
        }
        evr.emplace_back(v);
    }
    while (m--) {
        int l, v;
        cin >> l >> v;
        v--;
        while (l--) {
            b.emplace_back(v);
        }
        evr.emplace_back(v);
    }
    ranges::sort(evr);
    evr.erase(unique(evr.begin(), evr.end()), evr.end());
    n = N, m = M;
    vector<vector<int>> clsa(n, vector<int>(k, n));
    vector<vector<int>> clsb(m, vector<int>(k, m));
    for (int i = n - 1; i >= 0; i--) {
        if (i + 1 < n) {
            clsa[i] = clsa[i + 1];
        }
        clsa[i][a[i]] = i;
    }
    for (int i = m - 1; i >= 0; i--) {
        if (i + 1 < m) {
            clsb[i] = clsb[i + 1];
        }
        clsb[i][b[i]] = i;
    }
    vector<vector<int>> dp(n, vector<int>(m, -1));
    auto game = [&](auto &&self, int x, int y) -> int {
        if (x >= n || y >= m) {
            return false;
        }
        if (dp[x][y] != -1) {
            return dp[x][y];
        }
        dp[x][y] = 0;
        for (auto &c: evr) {
            int nx = clsa[x][c];
            int ny = clsb[y][c];
            if (nx < n && ny < m && !self(self, nx + 1, ny + 1)) {
                return dp[x][y] = 1;
            }
        }
        return dp[x][y];
    };
    while (q--) {
        int x, y;
        cin >> x >> y;
        cout << (game(game, x, y) ? "Yes\n" : "No\n");
    }
    return 0;
}
