#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,popcnt,lzcnt")
using namespace std;
void solve() {
    int n, nl, m, ml;
    cin >> n >> nl >> m >> ml;
    int k, q; cin >> k >> q;
    vector<int> a(n), b(m);
    for (int q = 0; q < n;) {
        int le, u; cin >> le >> u;
        for (int j = q; j < q + le; j++) {
            a[j] = u;
        }
        q += le;
    }
    for (int q = 0; q < m;) {
        int le, u; cin >> le >> u;
        for (int j = q; j < q + le; j++) {
            b[j] = u;
        }
        q += le;
    }
    vector<vector<int>> wa(k + 1);
    vector<vector<int>> wb(k + 1);
    for (int i = 0; i < n; i++) {
        wa[a[i]].push_back(i);
    }
    for (int i = 0; i < m; i++) {
        wb[b[i]].push_back(i);
    }
    vector<vector<int>> dp(n + 1, vector<int>(m + 1));
    for (int i = 0; i <= n; i++) {
        dp[i][m] = 0;
    }
    for (int i = 0; i <= m; i++) {
        dp[n][i] = 0;
    }
    vector<vector<int>> nxt(n, vector<int>(k + 1, -1));
    for (int i = n - 1; i >= 0; i--) {
        for (int elem = 1; elem <= k; elem++) {
            if (a[i] == elem) {
                nxt[i][elem] = i;
            } else {
                if (i + 1 < n) nxt[i][elem] = nxt[i + 1][elem];
            }
        }
    }
    vector<vector<int>> nxtb(m, vector<int>(k + 1, -1));
    for (int i = m - 1; i >= 0; i--) {
        for (int elem = 1; elem <= k; elem++) {
            if (b[i] == elem) {
                nxtb[i][elem] = i;
            } else {
                if (i + 1 < m) nxtb[i][elem] = nxtb[i + 1][elem];
            }
        }
    }
    for (int i = n - 1; i >= 0; i--) {
        for (int j = m - 1; j >= 0; j--) {
            if (i > 0 && j > 0 && a[i - 1] != b[j - 1]) continue;
            for (int elem = k; elem >= 1; elem--) {
                int ip = nxt[i][elem];
                int jp = nxtb[j][elem];
                if (ip != -1 && jp != -1) {
                    if (dp[ip + 1][jp + 1] == 0) {
                        dp[i][j] = 1;
                        break;
                    }
                }
            }
        }
    }
    while (q--) {
        int i, j; cin >> i >> j;
        if (dp[i][j] % 2) cout << "Yes\n";
        else if (i > 0 && j > 0 && a[i - 1] == b[j - 1]){
            cout << "No\n";
        } else {
            bool ok = false;
            for (int elem = k; elem >= 1; elem--) {
                int ip = nxt[i][elem];
                int jp = nxtb[j][elem];
                if (ip != -1 && jp != -1) {
                    if (dp[ip + 1][jp + 1] == 0) {
                        ok  = true;
                        break;
                    }
                }
            }
            if (ok) cout << "Yes\n";
            else cout << "No\n";
        }
    }
}
signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    solve();
    return 0;
}
