#include <bits/stdc++.h>
using namespace std;
#define int long long

template<typename T>
istream& operator>>(istream& in, vector<T>& v) {
    for (T& i : v) in >> i;
    return in;
}

bool win[5005][5005];
bool win1[5005][5005];

void solve() {
    int n, nc, m, mc, k, q;
    cin >> n >> nc >> m >> mc >> k >> q;
    vector<int> a, b;
    for (int i = 0; i < nc; i++) {
        int l, v;
        cin >> l >> v;
        for (int j = 0; j < l; j++)
            a.push_back(v);
    }

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

    map<int, int> nxta;

    for (int i = n - 1; i >= 0; i--){
        map<int, int> nxtb;
        set<int> nlose;
        for (int j = m - 1; j >= 0; j--) {
            if (a[i] != b[j]) {
                nxtb[b[j]] = j;

                nlose.erase(b[j]);
                nxtb[b[j]] = j;
                if (nxta.count(b[j]) && !win[nxta[b[j]]][j]) {
                    nlose.insert(b[j]);
                }

                continue;
            }
            if (!nlose.empty())
                win[i][j] = true;

            nlose.erase(b[j]);
            nxtb[b[j]] = j;
            if (nxta.count(b[j]) && !win[nxta[b[j]]][j]) {
                nlose.insert(b[j]);
            }
        }
        nxta[a[i]] = i;
        nxtb.clear();
        nlose.clear();

        for (int j = m - 1; j >= 0; j--) {
            if (a[i] != b[j]) {
                nxtb[b[j]] = j;

                nlose.erase(b[j]);
                nxtb[b[j]] = j;
                if (nxta.count(b[j]) && !win[nxta[b[j]]][j]) {
                    nlose.insert(b[j]);
                }

                continue;
            }
            nxtb[b[j]] = j;

            nlose.erase(b[j]);
            nxtb[b[j]] = j;
            if (nxta.count(b[j]) && !win[nxta[b[j]]][j]) {
                nlose.insert(b[j]);
            }

            if (!nlose.empty())
                win1[i][j] = true;
        }
    }

    while (q--) {
        int x, y;
        cin >> x >> y;
        cout << (win1[x][y] ? "Yes" : "No") << '\n';
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//     cin >> t;
    while (t--)
        solve(), cout << '\n';
}
