#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,popcnt,lzcnt")
using namespace std;
mt19937 mt(239);
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 + 1, 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 + 1, 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--) {
        vector<pair<int, int>> save(k + 1, {-1, -1});
        set<tuple<int, int, int>> z; //(val, i, j)
        for (int j = m - 1; j >= 0; j--) {
            int qp = nxt[i][b[j]];
            if (qp != -1) {
                if (save[b[j]].first != -1) {
                    auto [ip, jp] = save[b[j]];
                    z.erase({dp[ip + 1][jp + 1], ip, jp});
                }
                save[b[j]] = {qp, j};
                z.insert({dp[qp + 1][j + 1], qp, j});
            }

            if (!z.empty() && !get<0>(*z.begin())) {
                dp[i][j] = 1;
            }
        }
    }
    while (q--) {
        int i, j; cin >> i >> j;
        if (dp[i][j]) 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;
}
