#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define endl "\n"
#define ff first
#define ss second
#define ordered_set tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>
#define all(x) x.begin(), x.end()

const int INF = 1e18;


void solve() {

    int n, ns, m, ms, k, q;
    cin >> n >> ns >> m >> ms >> k >> q;

    vector<int> a;
    vector<int> b;

    for (int i = 0; i < ns; i++) {
        int l, v;
        cin >> l >> v;
        while (l--) {
            a.push_back(v);
        }
    }

    for (int i = 0; i < ms; i++) {
        int l, v;
        cin >> l >> v;
        while (l--) {
            b.push_back(v);
        }
    }

    vector<vector<int>> dp(n, vector<int>(m, -1));

    map<int, int> lapi;

    for (int i = n - 1; i >= 0; i--) {
        lapi[a[i]] = i;
        int sm = 0;
        map<int, int> lapj;
        for (int j = m - 1; j >= 0; j--) {
            if (lapi.count(b[j])) {
                if (lapj.count(b[j])) {
                    if (lapi[b[j]] == n - 1 || lapj[b[j]] == m - 1 || dp[lapi[b[j]] + 1][lapj[b[j]] + 1] == 0) {
                        sm--;
                    }
                }
                lapj[b[j]] = j;
                if (lapi[b[j]] == n - 1 || j == m - 1 || dp[lapi[b[j]] + 1][j + 1] == 0) {
                    sm++;
                }
            }
            dp[i][j] = (sm > 0);
        }
    }

//    for (auto it: dp) {
//        for (auto tt: it) {
//            cout << tt << " ";
//        }
//        cout << endl;
//    }

    while (q--) {
        int x, y;
        cin >> x >> y;
        if (dp[x][y]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int TN;
    TN = 1;
//    cin >> TN;

    while (TN--) {
        solve();
    }

}
