#include <bits/stdc++.h>

using namespace std;

constexpr int maxn = 5e3 + 5;

int dp[maxn][maxn];

int dp_fast[maxn][maxn];

int cnt[maxn][maxn];

int l_a[maxn], v_a[maxn];

int l_b[maxn], v_b[maxn];

int pr_sum_a[maxn];

int pr_sum_b[maxn];

int nxt_a[maxn][maxn];

int nxt_b[maxn][maxn];

void solve() {
    int N, n, M, m, k, q;
    cin >> N >> n >> M >> m >> k >> q;
    for (int i = 0; i < n; ++i) {
        cin >> l_a[i] >> v_a[i];
        pr_sum_a[i + 1] = pr_sum_a[i] + l_a[i];
        v_a[i]--;
    }
    for (int i = 0; i < m; ++i) {
        cin >> l_b[i] >> v_b[i];
        pr_sum_b[i + 1] = pr_sum_b[i] + l_b[i];
        v_b[i]--;
    }
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j < k; ++j) {
            nxt_a[i][j] = n;
        }
        for (int j = i; j < n; ++j) {
            nxt_a[i][v_a[j]] = min(nxt_a[i][v_a[j]], j);
        }
    }
    for (int i = 0; i <= m; ++i) {
        for (int j = 0; j < k; ++j) {
            nxt_b[i][j] = m;
        }
        for (int j = i; j < m; ++j) {
            nxt_b[i][v_b[j]] = min(nxt_b[i][v_b[j]], j);
        }
    }
    auto check_move = [&](int i, int j, int v) -> bool {
        return nxt_a[i + 1][v] != n && nxt_b[j + 1][v] != m && !dp[nxt_a[i + 1][v]][nxt_b[j + 1][v]];
    };
    for (int i = n - 1; i >= 0; --i) {
        for (int j = m - 1; j >= 0; --j) {
            if (j == m - 1) {
                cnt[i][j] = 0;
            } else {
                cnt[i][j] = cnt[i][j + 1];
                if (check_move(i, j + 1, v_b[j + 1])) {
                    cnt[i][j]--;
                }
                if (check_move(i, j, v_b[j + 1])) {
                    cnt[i][j]++;
                }
            }
            if (v_a[i] != v_b[j]) {
                continue;
            }
            if (cnt[i][j] > 1 || (cnt[i][j] == 1 && !check_move(i, j, v_a[i]))) {
                dp_fast[i][j] = 1;
            }
            int x = 0, y = 0;
            int ord = 0;
            int i_nw = i, j_nw = j;
            while (true) {
                if (ord == 0) {
                    if (dp_fast[i_nw][j_nw]) {
                        dp[i][j] = 1;
                        break;
                    }
                } else {
                    if (dp_fast[i_nw][j_nw]) {
                        break;
                    }
                }
                int len = min(l_a[i_nw] - x, l_b[j_nw] - y);
                if ((nxt_a[i_nw + 1][v_a[i]] == n && x + len == l_a[i_nw]) || (nxt_b[j_nw + 1][v_a[i]] == m && y + len == l_b[j_nw])) {
                    if (ord == 0) {
                        if (len % 2 == 0) {
                            dp[i][j] = 1;
                        }
                    } else {
                        if (len % 2 == 1) {
                            dp[i][j] = 1;
                        }
                    }
                    break;
                } else {
                    if (len % 2 == 1) {
                        ord ^= 1;
                    }
                    x += len;
                    if (x == l_a[i_nw]) {
                        x = 0;
                        i_nw = nxt_a[i_nw + 1][v_a[i]];
                    }
                    y += len;
                    if (y == l_b[j_nw]) {
                        y = 0;
                        j_nw = nxt_b[j_nw + 1][v_a[i]];
                    }
                }
            }
        }
    }
    while (q--) {
        int x, y;
        cin >> x >> y;
        int i = upper_bound(pr_sum_a, pr_sum_a + n + 1, x) - pr_sum_a - 1;
        int j = upper_bound(pr_sum_b, pr_sum_b + m + 1, y) - pr_sum_b - 1;
        x -= pr_sum_a[i];
        y -= pr_sum_b[j];
        int ans = 0;
        if (dp_fast[i][j]) {
            ans = 1;
        }
        if (!ans) {
            int i_nw = i, j_nw = j;
            int ord = 1;
            while (true) {
                if (ord == 0) {
                    if (dp_fast[i_nw][j_nw]) {
                        ans = 1;
                        break;
                    }
                } else {
                    if (dp_fast[i_nw][j_nw]) {
                        break;
                    }
                }
                int len = min(l_a[i_nw] - x, l_b[j_nw] - y);
                if ((nxt_a[i_nw + 1][v_a[i]] == n && x + len == l_a[i_nw]) || (nxt_b[j_nw + 1][v_a[i]] == m && y + len == l_b[j_nw])) {
                    if (ord == 0) {
                        if (len % 2 == 0) {
                            ans = 1;
                        }
                    } else {
                        if (len % 2 == 1) {
                            ans = 1;
                        }
                    }
                    break;
                } else {
                    if (len % 2 == 1) {
                        ord ^= 1;
                    }
                    x += len;
                    if (x == l_a[i_nw]) {
                        x = 0;
                        i_nw = nxt_a[i_nw + 1][v_a[i]];
                    }
                    y += len;
                    if (y == l_b[j_nw]) {
                        y = 0;
                        j_nw = nxt_b[j_nw + 1][v_a[i]];
                    }
                }
            }
        }
        if (ans) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
