#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void solve() {
    int N, sn, M, sm, k, q;
    cin >> N >> sn >> M >> sm >>     k >> q;
    if (0 && N <= 5000 && M <= 5000) {
        vector<pair<int, int>> segN(sn), segM(sm);
        vector<int> a(N), b(M);
        for (int i = 0, head = 0; i < segN.size(); ++i) {
            cin >> segN[i].first >> segN[i].second;
            --segN[i].second;
            for (int _ = 0; _ < segN[i].first; ++_) {
                a[head++] = segN[i].second;
            }
        }
        for (int i = 0, head = 0; i < segM.size(); ++i) {
            cin >> segM[i].first >> segM[i].second;
            --segM[i].second;
            for (int _ = 0; _ < segM[i].first; ++_) {
                b[head++] = segM[i].second;
            }
        }

        vector dp(N, vector<int>(M, -1));
        /*
         * dp[i][j] = false => can't win
         * dp[i][j] = x + 1 => the only winning move
         * dp[i][j] = k + 2 => several winning moves
         */
        vector<int> last_a(k, -1);
        for (int i = N - 1; i >= 0; --i) {
            vector<int> val(k, -1);
            int cnt[2]{};
            set<int> ff;
            for (int j = M - 1; j >= 0; --j) {
                if (a[i] == b[j]) {
                    if (cnt[0]) {
                        dp[i][j] = cnt[0] > 1 ? k + 2 : *ff.begin() + 1;
                    } else {
                        dp[i][j] = false;
                    }
                }
                if (last_a[b[j]] != -1) {
                    int x = b[j];
                    if (val[x] != -1) {
                        cnt[bool(val[x])] -= 1;
                        if (val[x] == 0) {
                            ff.erase(x);
                        }
                    }
                    cnt[val[x] = bool(dp[last_a[x]][j])] += 1;
                    if (val[x] == 0) {
                        ff.insert(x);
                    }
                }
            }
            last_a[a[i]] = i;
        }

        auto qry = [&](int i, int j) {
            if (a[i] != b[j]) {
                return false;
            }
            if (dp[i][j] == false || dp[i][j] != a[i] + 1) {
                return true;
            } else {
                return false;
            }
        };

        if (1) {
            while (q--) {
                int i, j;
                cin >> i >> j;
                if (dp[i][j] == false || dp[i][j] != a[i] + 1) {
                    cout << "Yes\n";
                } else {
                    cout << "No\n";
                }
            }
        } else {
            for (int i = 0; i < N; ++i) {
                for (int j = 0; j < M; ++j) {
                    cout << qry(i, j) << "";
                }
                cout << endl;
            }
        }
        return;
    }
    vector<pair<int, int>> segN(sn), segM(sm);
    vector<int> a(sn), lena(sn), b(sm), lenb(sm);
    for (int i = 0, head = 0; i < segN.size(); ++i) {
        cin >> segN[i].first >> segN[i].second;
        --segN[i].second;
        a[i] = segN[i].second;
        lena[i] = segN[i].first;
    }
    for (int i = 0, head = 0; i < segM.size(); ++i) {
        cin >> segM[i].first >> segM[i].second;
        --segM[i].second;
        b[i] = segM[i].second;
        lenb[i] = segM[i].first;
    }

    vector dp(sn, vector<int>(sm, -1));
    vector anyLose(sn, vector<int>(sm, 0));
    vector adja(k + 10, vector<int>{}), adjb(adja);
    vector<int> posa(sn), posb(sm), suma(sn), sumb(sm);
    vector<int> ptra(sn), ptrb(sm);
    for (int i = 0; i < sn; ++i) {
        adja[a[i]].push_back(i);
        posa[i] = adja[a[i]].size() - 1;
        ptra[a[i]] += lena[i];
        suma[i] = ptra[a[i]];
    }
    for (int i = 0; i < sm; ++i) {
        adjb[b[i]].push_back(i);
        posb[i] = adjb[b[i]].size() - 1;
        ptrb[b[i]] += lenb[i];
        sumb[i] = ptrb[b[i]];
    }

    auto query = [&](int i, int j, int prefi, int prefj) -> bool {
//        vector<array<int, 3>> A, B;
//        int dista = 0, distb = 0;
        // TODO: don't create the arrays
        // TODO: iterate only over the same values
//        for (int ik = i, dist = 0; ik < sn; ++ik) {
//            if (a[ik] == a[i]) {
//                A.push_back({dist, lena[ik] - (ik == i ? prefi : 0), ik});
//                dist += lena[ik] - (ik == i ? prefi : 0);
//                dista = dist;
//            }
//        }
        // lena[ik] - (ik == i ? prefi : 0)
        // lenb[jk] - (jk == j ? prefj : 0)
        // TODO: iterate only over the same values
//        for (int jk = j, dist = 0; jk < sm; ++jk) {
//            if (b[jk] == b[j]) {
//                B.push_back({dist, lenb[jk] - (jk == j ? prefj : 0), jk});
//                dist += lenb[jk] - (jk == j ? prefj : 0);
//                distb = dist;
//            }
//        }
//        int ik = 0, jk = 0, dist = 0;
//        while (true) {
//            if (ik + 1 < A.size() && (jk + 1 >= B.size() || A[ik + 1][0] < B[jk + 1][0])) {
//                ik += 1;
//                dist = A[ik][0];
//            } else {
//                jk += 1;
//                if (jk >= B.size()) {
//                    break;
//                }
//                dist = B[jk][0];
//            }
//            while (ik == -1 ||  ik < A.size() && A[ik][0] + A[ik][1] <= dist) {
//                ik += 1;
//            }
//            while (jk == -1 || jk < B.size() && B[jk][0] + B[jk][1] <= dist) {
//                jk += 1;
//            }
//            if (ik >= A.size() || jk >= B.size()) {
//                break;
//            }
//            int idi = A[ik][2];
//            int idj = B[jk][2];
//            if (anyLose[idi][idj]) { // TODO: find the first (idi, idj) where this is satisfied
//                return (dist & 1 ? false : true);
//            }
//        }
//        dist = min(dista, distb);
//        return (dist & 1 ? false : true);
        int x = a[i];
        int ik = posa[i], jk = posb[j], dist = 0, dista = 0, distb = 0;
        while (true) {
            if (ik + 1 < adja[x].size() && (jk + 1 >= adjb[x].size() || dista + lena[adja[x][ik]] - (ik == posa[i] ? prefi : 0) < distb + lenb[adjb[x][jk]] - (jk == posb[j] ? prefj : 0))) {
                dist = dista + lena[adja[x][ik]] - (ik == posa[i] ? prefi : 0);
                dista = dist;
                ik += 1;
            } else {
                if (jk + 1 >= adjb[x].size()) {
                    break;
                }
                dist = distb + lenb[adjb[x][jk]] - (jk == posb[j] ? prefj : 0);
                distb = dist;
                jk += 1;
            }
            while (ik < adja[x].size() && dista + lena[adja[x][ik]] - (ik == posa[i] ? prefi : 0) <= dist) {
                dista += lena[adja[x][ik]] - (ik == posa[i] ? prefi : 0);
                ik += 1;
            }
            while (jk < adjb[x].size() && distb + lenb[adjb[x][jk]] - (jk == posb[j] ? prefj : 0) <= dist) {
                distb += lenb[adjb[x][jk]] - (jk == posb[j] ? prefj : 0);
                jk += 1;
            }
            if (ik >= adja[x].size() || jk >= adjb[x].size()) {
                break;
            }
            int idi = adja[x][ik];
            int idj = adjb[x][jk];
            if (anyLose[idi][idj]) { // TODO: find the first (idi, idj) where this is satisfied
                return (dist & 1 ? false : true);
            }
        }
        int DA = ptra[x] - suma[i] + (lena[i] - prefi);
        int DB = ptrb[x] - sumb[j] + (lenb[j] - prefj);
//        cout << DA << " " << DB << endl;
        dist = min(DA, DB);
        return (dist & 1 ? false : true);
    };

    // TODO: optimize this into N^2
    vector<int> last_a(k, -1);
    for (int i = sn - 1; i >= 0; --i) {
        vector<int> val(k, -1);
        int cnt[2]{};
        set<int> ff;
        for (int j = sm - 1; j >= 0; --j) {
            if (a[i] == b[j]) {
                if (cnt[0] > 1 || cnt[0] == 1 && *ff.begin() != a[i]) {
                    dp[i][j] = true;
                    anyLose[i][j] = true;
                } else {
                    dp[i][j] = query(i, j, 0, 0); // TODO: note that it's N^3
                }
            }
            if (last_a[b[j]] != -1) {
                int x = b[j];
                if (val[x] != -1) {
                    cnt[bool(val[x])] -= 1;
                    if (val[x] == 0) {
                        ff.erase(x);
                    }
                }
                cnt[val[x] = bool(dp[last_a[x]][j])] += 1;
                if (val[x] == 0) {
                    ff.insert(x);
                }
            }
        }
        last_a[segN[i].second] = i;
    }

    vector<int> prefLena(sn + 1), prefLenb(sm + 1);
    for (int i = 0; i < sn; ++i) {
        prefLena[i + 1] = prefLena[i] + lena[i];
    }
    for (int i = 0; i < sm; ++i) {
        prefLenb[i + 1] = prefLenb[i] + lenb[i];
    }

    auto qry = [&](int prefi, int prefj) {
        int i = 0, j = 0;
        i = upper_bound(prefLena.begin(), prefLena.end(), prefi) - prefLena.begin() - 1;
        prefi -= prefLena[i];
        j = upper_bound(prefLenb.begin(), prefLenb.end(), prefj) - prefLenb.begin() - 1;
        prefj -= prefLenb[j];
        if (a[i] != b[j]) {
            return false;
        }
        if (anyLose[i][j]) {
            return true;
        }
//        prefi += 1, prefj += 1;
//        while (prefi >= lena[i]) {
//            prefi -= lena[i];
//            i += 1;
//        }
//        while (prefj >= lenb[j]) {
//            prefj -= lenb[j];
//            j += 1;
//        }
        if (!query(i, j, prefi, prefj)) {
            return true;
        } else {
            return false;
        }
    };

    if (1) {
        // TODO: note that you didn't even have the tests with q = 10^6.
        while (q--) {
            int prefi, prefj;
            cin >> prefi >> prefj;
            if (qry(prefi, prefj)) {
                cout << "Yes\n";
            } else {
                cout << "No\n";
            }
        }
    } else {
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < M; ++j) {
                cout << qry(i, j);
            }
            cout << endl;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int test = 1;
//    cin >> test;
    while (test--) {
        solve();
    }

    return 0;
}